#### Answer

$T = \frac{M~m~g}{M+m}$

#### Work Step by Step

We can find the acceleration of the system of both blocks as;
$F = (M+m)~a$
$mg = (M+m)~a$
$a = \frac{mg}{M+m}$
Let's consider the system of only the block of mass $M$. The tension $T$ in the string provides the force to move this block with the acceleration we found above;
$T = Ma$
$T = (M)(\frac{mg}{M+m})$
$T = \frac{M~m~g}{M+m}$