\documentclass[12pt]{article}

\begin{document}

$$ 
  E = K (\theta - \theta_0)^2 + K_{UB} (r - r_{UB})^2 
$$

\end{document}