Two masses m1 and m2 are connected by a spring of spring constant k and are placed on a smooth horizontal surface . Initially the spring is stretched through a distance d when the system is released from rest. Find the distance moved by the two masses when spring is compressed by a distance d .