(a) The trustee shall apply the proceeds of sale, first to the payment of expenses attending the execution of the trust, including a commission to the trustee of five percent on the first $300, and two percent on the residue of the proceeds, and shall apply the balance of such proceeds pro rata, or in the order of priority, if any, prescribed by the trust deed, to the payment of the debts secured and the indemnity of the sureties indemnified by the deed, and shall pay the surplus, if any, to the grantor, his, her or its heirs, personal representatives, successors or assigns, as their interests may appear.
(b) A trust deed grantor, the obligor on the debt secured by the deed of trust, including any maker, comaker, guarantor, surety or other accommodation party, or other defendant in a civil action seeking a deficiency judgment on the debt secured by the deed of trust, may not assert as a defense that the fair market value of secured real property was not obtained at a trust deed foreclosure sale conducted in accordance with this article.