When the block m2 moves downward with acceleration a, the acceleration of mass m1 will be 2a, because it covers double distance in the same time in comparison to m2. Let T is the tension in the string.
From the free body diagram of A and B we get T=m12a ...(i) m2g−2T=m2a .....(ii) From Eqs. (i) and (ii), we get a=