The initial length of the spring is $l_0$.
I need help understanding how the potential energy of this system comes to be. I know the answer:
$$ U = -(m_1-m_2)gx-(m_1+m_2)gy+\frac{1}{2}k(y-l_0)^2+U_0 $$
I understand that the term: $\frac{1}{2}k(y-l_0)^2$ is the potential energy of the spring and I know how that comes to be. And I guess that the terms $-(m_1-m_2)gx$ and $-(m_1+m_2)gy$ are the potential energies due to gravity? But where does $U_0$ come from?