# Effective Mass of a moving Pulley system

What is the effective mass of a an accelerating pulley block system?

Consider the setup shown above.

I was trying to find the mass $$m$$, which would produce the same acceleration of the moving pulley system (as a whole) i.e. $$a_1$$ when the moving pulley system(along with the 2 blocks) is replaced by a block of mass $$m$$. Using Newton's second law and the constraint relations, I got the following system of equations.Let $$2T$$ be the tension in the topmost string(The one in the diagram where $$a_1$$ is writen). Here, $$g$$ is the acceleration due to gravity. $$mg-2T=ma_1\\Mg-T=Ma_2\\2Mg-T=2Ma_3\\a_2+a_3=2a_1$$ On solving the system of equations, I got $$m=\frac{8M}{3}$$

But, since we are taking the movable pulley along with the 2 blocks as our system, shouldn't the total mass of the system be the sum of the masses of the individual masses of the system(in this case, the $$m$$ should be $$3M$$)?

MAIN QUESTION:
Is it that the total mass of a system is not in general the sum of masses of its individual components?In what cases is it valid? Where am I wrong?