\frac{\displaystyle kx^2}{\displaystyle 2 \vphantom{1^a}} + \frac{\displaystyle mv^2}{\displaystyle 2 \vphantom{1^a}}=\frac{\displaystyle kx_0^2}{\displaystyle 2 \vphantom{1^a}} = \frac{\displaystyle mv_0^2}{\displaystyle 2 \vphantom{1^a}}.