2 mass spring system

Two blocks of masses m1 and m2 are connected by a spring of spring constant k.now forces F1 and F2 start acting on the two blocks in a manner to stretch the spring.Find the max.elongation of the spring.

What I could figure out was to conserve the energy. Energy stored in spring when elongation is x would be 1/2kx^2. Work done by F1 would be F1x and by F2 would be F2x. So,equating them, we would get x=2(F1 + F2)/k.

Thanks
 PhysOrg.com science news on PhysOrg.com >> Galaxies fed by funnels of fuel>> The better to see you with: Scientists build record-setting metamaterial flat lens>> Google eyes emerging markets networks
 Anyone ? The system will have some acceleration too. So, there must be some other catch in the problem.
 Hmmmm.... Because the forces are not equal,the whole system starts to move. $$F_1-kx=m_1a$$ $$kx-F_2=m_2a$$

2 mass spring system

Yes..but that isnt really helping in find the max elongation. The elongation will increase and after reaching the max value, will start to decrease again.
 $$F_1-F_2=(m_1+m_2)a$$ $$F_1-T_1=m_1a$$ $$T_2-F_2=m_2a$$ energy stored in the spring equals to $$E=T_1x_1+T_2x_2$$
 Isnt T1=T2=kx ?
 No,I just confused they are not egual.Spring is oscillating,this makes them to be inequal.
 Hey thanks Got the answer as 2(f1M1 +f2M2)/k(M1+M2) Thanks again
 Must be $$\frac{1}{2}k(x_1+x_2)^2=\frac{(F_1m_2+F_2m_1)}{m_1+m_2}(x_1+x_2)$$ so $$(x_1+x_2)=0$$ minimum elongation and $$(x_1+x_2)=2\frac{F_1m_2+F_2m_2}{k(m_1+m_2)}$$ maximum.
 Hey wait....but wouldnt energy stored in spring be $$F_1x_1 + F_2x_2$$ since $$F_1 , F_2$$ are the external forces on the spring system ?
 $$T_1x_1+T_2x_2=(F_1-m_1a)x_1+(F_2+m_2a)x_2$$ $$(F_1-F_2)d=\frac{1}{2}kx^2+\frac{1}{2}(m_1+m_2)v^2$$ if energy stored in the spring were $$F_1x_1 + F_2x_2$$,it means that spring is not moving.