If the sales price you are offered falls short of the amount you owe the lender -- called a "short sale" -- you need to get permission from your lender. This is because your lender is not required to release its lien on your home unless the mortgage is paid off in full. You'll need to negotiate with your lender to get them to agree to release their lien for less than the amount you owe. No purchaser will want your home unless they get clear title to the property, free of liens from your lenders.
Keep in mind that in most states, technically a lender is allowed to sue you after the house is sold (or foreclosed on) to recover any remaining deficiency -- the difference between the sales price and what you owe on the mortgage. In most cases, however, a lender is not likely to sue for a deficiency. But to be safe, make sure you get in writing from your lender a release from liability for any deficiency. If you live in a state that doesn't allow a lender to sue you for a deficiency, you don't need to get a release from the deficiency in writing.
Short sales usually are more difficult to complete if there is a second mortgage, unless the same lender owns both loans. Also, some homeowners may be better off letting a foreclosure take place, saving a few month's mortgage payments until it happens. For more information on short sales, see Nolo's article Short Sales and Deeds in Lieu of Foreclosure.