Let [itex]l_0[/itex] denote the original length and [itex]l_1[/itex] and [itex]l_2[/itex] the two secondary lengths. Then the problem as given us [itex]l_1-l_0[/itex] and [itex]l_2-l_0[/itex] and [itex]m_1[/itex] and [itex]m_2[/itex]. So we have four unknowns ([itex]k, l_0, l_1, l_2[/itex]) and need four equations.
Two of them are [itex]k(l_i-l_0)=m_i g[/itex].
For the other two, we can use conservation of energy. But if we assume that the spring is at rest in after the elongation i.e. in its second equilibrium length, we will have [itex]\frac 1 2 k (l_i-l_0)^2=m_i g (l_i-l_0)[/itex], which are in contradiction with our first two equations. So that assumption is wrong and its easy to understand. When you attach a weight to the spring, its equilibrium length changes and so the fact that its now shorter, before actually reaching its new equilibrium length, means that its stretched and so it starts to vibrate. So when it reaches its new equilibrium length, it will have a kinetic energy which should be considered in the conservation of energy equations.
And for calculating those speeds, you should solve the equations of motion [itex]m\ddot{x}_i=-kx_i-m_ig \ \ \ (x_i=l_i-l_0)[/itex] and then find at what time, the spring has length [itex]l_0+\frac{m_i g}{k}[/itex] and put that time into [itex]\dot{x}_i(t)[/itex] to find the speeds.