To rearrange the equation for the surface area \( S \) of a square pyramid, given by
\[ S = \frac{1}{2} lp + B, \]
we want to isolate \( B \).
To do this, we can start by subtracting \( \frac{1}{2} lp \) from both sides of the equation:
\[ S - \frac{1}{2} lp = B. \]
Thus, we have:
\[ B = S - \frac{1}{2} lp. \]
Therefore, the expression for \( B \) is:
\[ \boxed{B = S - \frac{1}{2} lp}. \]