I take it you mean the original problem is , because the 2m term appears out of nowhere in the second step.
For the moment, let's focus on the exponent:
Rearranging, we get
Complete the square to get
With this, we can now evaluate this integral instead:
Now apply the substitution .
Thus, the integral becomes
Now apply (*) to get
which appears to be different from the answer you have supplied....so maybe I made a mistake somewhere??
But this is the idea of how to approach this problem. Hope this helps!