I have the following code:
\documentclass{article}
\usepackage{amsmath, amssymb, amsthm, graphicx, textcomp}
\begin{document}
d^2(A,B)=\begin{cases}
(a_1-b_1)^2(1+m^2) &&\text{if $AB$ has slope $m$} \\
(a_2-b_2)^2 &&\text{if $AB$ is a vertical line}
\end{cases}
\end{document}
but I get this output:

Is there a way to get the text on the right after the formulas, so that there are only two lines? Thanks.