Consider the two blocks plus the spring to be the system. No exterN/Al force acts on this system in horizontal direction. Hence, the linear momentum will remain constant. As the spring is light, it has no linear momentum. Suppose the block of mass M moves with a speed V and the other block with a speed v after losing contact with the spring. As the blocks are released from rest the initial momemtum is zero. The fiN/Al momentum is `MV-mv` towards right. Thus,
`MV-mv=0 or V=m/Mv`......... i
initially the energy of the system `=1/2 kx^2`.
FiN/Ally, the energy of the system `=1/2mv^2+1/2MV^2`
As there is no friction
`1/2mv^2+1/2MV^2=1/2kx^2`....ii
Using i and ii
`mv^2(1+m/M)=kx^2`
or, `v=sqrt((kM)/(m(M+m))x)`
and `V=sqrt((km)/(M(M+m)_)x`