A ball of mass m is projected with a speed v into the barrel of a spring gun of mass M initially at rest lying on a frictionless surface. The mass sticks in the barrel at the point of maximum compression in the spring. The fraction of kinetic energy of the ball stored in the spring is :