Which is foreclosing - the first or second mortgage? They have priority and it matters a great deal.
I am not an attorney, just a realtor, but since no one else has answered... If the first mortgage holder is foreclosing then I understand that the first mortgage folder will receive the funds from the sale of the home. Any remaining funds will go toward the second mortgage.
Whereas, if the second mortgage is foreclosing, they will have to buy-out the first mortage before they can foreclose.