YEs , it is m1 only....
2T'=T {Pulley is Massless }
Let the acceleration of M be ' a '
T=Ma
2T'=Ma.............(1)
alSO acceleration of P1 = a ..........{ Constraint }
2g-T'=2a'
T'-g=a'
From this we have ,
a'=g3
T'=4g3
So m1 is moving up with an acceleration 'g3'
And the pulley is moving down with an acceleration 'a'
If both these acceleration are equal ,m1 will have no apparent acceleration
Putting a=g3 & T'=4g3 in equation (1)
24g3=Mg3
M=8