As there is no external force in x-direction, applying conservation of momentum during collision
`m_(1)v_(1)=(m_(1)+m_(2))V_(B)`
`therefore" "V_(B)=(m_(1)v_(1))/(m_(1)+m_(2))`…..(i)
Applying conservation of mechanical energy after collision
`(1)/(2)(m_(1)+m_(2))V_(B)^(2)=(m_(1)+m_(2))=gh`
here `h` is the displacement of center of mass:
`V_(B)=sqrt(2gh)`....(ii)
Form (i) & (ii)
`therefore" "V_(1)=(1+(m_(2))/(m_(1)))sqrt(2gh)`