Two bodies connected by a spring I came across of a problem. It is about two bodies with equal masses connected by a spring with the coefficient $k$ and the length of $l_0$. Suddenly, a constant force $F$ is applied to the first body. Find the minimum and maximum distance between the bodies. The drawing illustrates the problem. 

Attempts to solve: I guess the idea behind of this problem should be similar to the idea of the problem where instead of two bodies there is only the left body to which the force is applied. And the right body is replaced with a wall. Then the solution is very simple using the energy conservation one finds that the minimum distance is $l_0  -2F/k$ and the maximum distance is the length of the spring.
For the original problem the energy conservation gives:
$W_{F} = K_1 + K_2 - U_{pot} $, where $W_F = F \cdot x_1$ - work done by the force $F$ over the distance $x_1$ and $K_1$, $K_2$  - the kinetic energies of the both bodies, $U_{pot}=(l0-(x_2-x_1))^2\cdot k/2$. Then the minimum distance is when the both kinetic energies are equal $K_1 = K_2 = K$. But that's not enough.
Q: Am I moving in the right direction? If yes, what else should be added to the energy conservation law to get the solution? 
PS: I  solved the equations of of the motion for these two bodies and plotted the corresponding kinetic and potential energies.Maybe it can be helpful. 
 
 A: The total force applied to the system is $F$, so the acceleration of the center of mass is $a=\frac{F}{2m}$. In the center of mass frame the middle of the spring is fixed, so the problem is equivalent to the one of a mass $m$ (the left one) connected to the fixed point by a spring with constant $2k$ (the real spring is made with two of these in series). Apart from the spring force, the total force applied to this mass is $F$ plus the fictitious force
$F_{f} = -m a = -\frac{F}{2}$ so the total force is $\frac{F}{2}$.
Now you can use the conservation of
$$
E= K + \frac{1}{2} (2k) \left(x+\frac{l_0}{2}\right)^2 -\frac{F}{2} x
$$
where the last term is minus the work done by the external and the fictitious force on the mass, and $x$ is its position (on the left of the fixed point).
Initially $x=-\frac{l_0}{2}$ and $K=0$. When the contraction of the spring is at its maximum $K=0$ and the distance between the two masses is $d=-2x$ so
$$
\frac{Fl_0}{4} = \frac{1}{2} (2k) \left(\frac{l_0}{2}-\frac{d}{2}\right)^2+\frac{Fd}{4} 
$$
Solving you get 
$$
d = l_0 -\frac{F}{k}
$$
