Let V1 be the velocity of 1 kg mass and V2 be the velocity of 2 kg mass.
After collision,
V1+2V2=2(1)
Also coefficient of restitution, e=V2−V12(2)
Solving (1) and (2)
V1=−23 and V2=43
T=2π√mk=2πsec
block returns to original position in T2=πsec
Distance between the blocks after collision when spring returns to unstretched position,d=23(π)=23(3.14)=2.0933m
d=2m