Initially, $$\omega ^2 = \dfrac{k}{m}$$
At $$t=0$$, block of mass m is at mean position $$(x = 10m)$$ and moving towards positive x direction with velocity $$A\omega$$ or $$30 \ m/s$$
From the conservation of linear momentum,
$$(M+m)v = M(30)$$
Substituting the values, we have
$$v = $$ velocity of combined mass just after collision $$ = 15 \ cm/s \ or \ 0.15 m$$
From the conservation of mechanical energy,
$$\dfrac{1}{2}(M+m)v^2 = \dfrac{1}{2}k(A)^2$$
Here $$A$$ is the new amplitude os oscillation
$$A = v\sqrt{\dfrac{M+m}{k}} = 0.15\sqrt{\dfrac{4}{100}} = 0.03 \ m $$
$$\therefore A = 30\ cm$$
Now, new angular frquency, $$\omega = \sqrt{\dfrac{k}{M+m}} = 5\ rad/s$$
$$\therefore Equation: x = 10 - 3sin(5t)$$
[$$NOTE:$$ there is a minus sign because after collition direction will be changed]