Here is a general budget constraint: $p{_1}x{_1}+p_{2}x_{2}=M\Leftrightarrow \frac{p_1}{p_2}x_1+x_2=\frac{M}{p_2}\Leftrightarrow {p_{1}}'x_1+x_2=M{}'$.
The main idea is that since prices are given, we can choose ${p_{2}}'=1$. However, I don't quite understand how they went on to the final line of the budget constraint from the second line.
I reckon they did implicit differentiation, but I am not understanding how they did it.
Edit: The $p's$, $x's$, and $M$ are price, quantity, and income, respectively.
$M=M(p_1,p_2,\overline U)$: The minimum income needed to buy the quantities of commodity 1 and commodity 2 that gives utility $\overline U$.
$M=p_1 \cdot x_1 + p_1 \cdot x_2 \Rightarrow p_1=\frac{M(p_1,p_2 , \overline U)-p_2 \cdot x_2}{x_1}$
$\frac{\partial p_1}{\partial p_2}=\frac{M'-x_2}{x_1}\Rightarrow p_1'\cdot x_1=M'-x_2$
Thus $p_1'\cdot x_1+x_2=(M'-x_2)+x_2=M'$