The elementary solution, you can calculate time, the equation of motion etc etc also:-
( ab is the unstreched spring at t=0, a'b is the streched spring at t=t )
at t=0 , Vm = -1 & Vb = 2
Suppose at time t=t, the extention in spring = x
=> displacement of m from t=0 will be 2*t - x , lets denote it by y ... this means Vm = dy/dt
=> dy/dt = 2 - dx/dt
=> d2y/dt2 = - d2x/dt2 ------- (1)
also d2y/dt2 = kx/m -----------------(2)
=> d2x/dt2 + kx/m = 0
=> x= A Sin(ωt) ... where ω=√k/m
=> dx/dt = Aω Cos(ωt)
now at t=0, y=0, x=0 & dy/dt=-1
this gives xmax = A = (2+1) * √m/k =0.6 m = 60 cm