# Mass attached to spring - elastic potential energy

I am looking at a problem in which a mass $m$ is attached to the midpoint of a light elastic spring of natural length $2l$ and then released. The two ends of the spring, $P$ and $Q$, are at the same horizontal level. It then comes to instantaneous rest when both parts of the spring make a certain angle $\theta$ with $PQ$. I am trying to find the modulus of elasticity.

I have solved the problem using the principle of the conservation of mechanical energy, i.e. $$\text{Loss in GPE} = \text{Gain in EPE}.$$ The problem is that I get different values for the EPE depending on whether I consider the spring as a whole, in which case the extension is $2l(\sec\theta-1)$, so $EPE=\dfrac{\lambda\cdot4l^2(\sec\theta-1)^2}{2l}$ or consider the two halves of the spring separately, in which case the EPE is $2\cdot \dfrac{\lambda l^2(\sec\theta-1)^2}{2l}$.

I know that the second one is the correct EPE, but why is it necessary to consider the two halves of the spring separately?

Update: I have reworked the problem and get the same answer in both cases, so it seems as though it does not matter whether or not both halves of the string are considered separately.