Considering that there is no friction, and there is obvious loss in potential energy of m, and so the energy will be converted to the only available place to store energy, the spring, thus spring potential energy.
with that in mind,
the total change in mechanical energy(for elastic collision)
\(mg \Delta h_1 = \frac{1}{2} k \Delta x^2 +Mg\Delta h_2 \)
where \(\Delta h =\Delta d \sin \theta\), assuming that 4cm that M moved is downwards,
so, \((1)(9.8)(4-2.56)(\sin 30^o)=\frac{1}{2}(11000)(0.04)^2 + M(9.8)(-0.04)\)
find M.