Who gets the REO? The 1st or the 2nd?

Tell me if I’m right. If the 2nd mtg. forecloses and the property doesn’t get sold at auction, then the 2nd loses out and the 1st takes the property back as an REO. Right?

If the 2nd want to get the property. they have to pay off the first lien holder

The first lien always needs to get paid, also the municipal liens