Hi Guest!
Welcome to forums!
After a foreclosure, you will be liable for paying off the deficient balance resulting from the sale of the property. Moreover, the second mortgage lender will also come after you in order to recover his debts. You can set up a payment plan with them in order to pay off the deficient balance. If you pay as per that plan, then you will be able to keep yourself out of the court.
Feel free to ask if you've further queries.
Sussane