A body of mass M1 moving with a velocity U collides with a stationary body…