Since
M2>M1, therefore
M2 moves downwards and
M1 moves upwards with an acceleration
a as shown in the figure.
Free body diagram of M_1
<imgsrc="/api/proxy−image?url=https \\
The equation of motion for
M1 is
T-M_1 g=M_1 a
Free body diagram of
M2<imgsrc="/api/proxy−image?url=https \\
The equation of motion for
M2 is
M_2 g-T=M_2 a
Adding (i) and (ii), we get
a=
M2+M1(M2−M1)g=(10+5)(10−5)g=3g