Answer:
M g = M a = a (9 - 7) kg with the two masses going in different directions
(7 + 9) kg * g = a * 2 kg 2 kg effective in prducing acceleration
a = 16 / 2 * g = 9.8 m/s^2 / 8 = 1.23 m/s^2
M1 a = T - M1 * g T producing upward acceleration of 1.23 m/s^2
T = 7 (a + g) = 7 * 11 = 77 N
Check:
M2 a = M2 * g - T M2 producing downward acceleration
T = M2 (g - a) = 9 * (9.8 - 1.23) = 77 N