I am building a spring launcher for an engineering project and need to calculate spring compression to achieve a projectile velocity of 4 m/s. The mass ${m}_{p}$ of the projectile is 5 g, the mass of the spring is 7 g and the spring constant is 1000 N/m.

Is it right to assume that initial potential energy in the spring = kinetic energy of the marble + kinetic energy of the spring at the point of release?

I can calculate the marble's kinetic energy easily enough using ${E}_{k}=\frac{1}{2}{m}_{p}{v}^{2}$. However, how would I calculate the spring's kinetic energy? One end is secured, while the other end would be traveling at the same speed as the marble. I think I would have to use integration somehow but not completely sure how to.