dear student
Initial momentum of the first body =mv ( along the x direction)
Initial momentum of the second body =0 ( along the x direction)
momentum of the first body before collision in the y direction =0
momentum of the second body before collision in y direction =0
Momentum of the first body after collision in the x direction =0
Momentum of the first body after collision in the y direction=
Momentum of the second body after collision in the x-direction is =2mvx
Momentum of the second body after collision in the x-direction is =2mv​y
Thus by conservation of momentum in x and y direction