From the law of conservation of energy \(\frac{1}{2}M{v^2} = \frac{1}{2}K{L^2}\)
\(\therefore \) \(v = \sqrt {\frac{K}{M}} L\)
Where \( v\) is the velocity of block by which it collides with spring.
So, its maximum momentum \(P = Mv = M\sqrt {\frac{K}{M}} \,L\) = \(\sqrt {MK} \,L\)
After collision the block will rebound with same linear momentum.