Rearrange to make M the subject
1/M = 1/M1 + 1/M2
$\displaystyle \frac{1}{m}=\frac{1}{m_{1}}+\frac{1}{m_{2}}=\frac{ m_{2}}{m_{1}m_{2}}+\frac{m_{1}}{m_{2}m_{1}}$
you have the same denominator,
$\displaystyle \frac{1}{m} =$ $\displaystyle \frac{1}{m_{1}}+\frac{1}{m_{2}}=\frac{m_{2}+m_{1}} {m_{2}m_{1}}$
to find m just flip the fraction,
$\displaystyle m=\frac{m_{2}m_{1}}{m_{2}+m_{1}}$
hope it helps.