If you know right now that you won't be able to do that, then you should contact your lender and find out if you would be eligible to sell short. In order for the bank to agree to this, you would have to prove a real hardship and the lender will ask for your bank account statements, your pay stubs, your income tax returns for the last two years and require that you submit a hardship letter describing why you are now in the position of not being able to pay your mortgage. If you meet the criteria, they may give you permission to contact a real estate agent to do a market analysis and put your home on the market for its fair market value. When you get an offer on the home, it will be contingent on the lender agreeing to accept less money for your mortgage than you really owe. They will factor in back mortgage payments, hoa dues, taxes, and costs of selling the home before they give your buyer the approval of their offer.
So...it sounds like you have some math to do. I'm assuming your agent gave you a net sheet which tells you what the proceeds to you are at the closing. You might also wish to consult with an attorney or accountant to help you determine the best course of action, considering your specific financial circumstances, taxes, etc.
Best of luck to you. I hope it works out to your satisfaction.
Coldwell Banker Residential Real Estate