max speed will occur when the spring relaxes to its uncompressed length ...

(1) energy conserved

$\dfrac{1}{2}kL^2 = \dfrac{1}{2}Mv_1^2 + \dfrac{1}{2}mv_2^2$

(2) momentum is conserved

$Mv_1 = mv_2$

solve for $v_1$ in terms of $v_2$ and sub into the energy equation, then solve for $v_2$