This is from a problem set of open course 8.02 by MIT OCW. I am not able to understand how the integral was solved. I have basic knowledge of Fourier transformation, and the Dirac delta function (somehow, I have a feeling that it may be in play here).
PS: I have just completed high school, so please try to explain it as per that knowledge level.
Furthermore, as mentioned above, I am taking this course voluntarily without credits, certification, so I guess its not violating any honour code.

First, let $y=\frac{x-x_0}{a}$. Then,
$$\begin{align} \frac{N}{\sqrt{2\pi}}\int_{-\infty}^{\infty}e^{-(x-x_0)^2/a}e^{ik_0x}e^{-ikx}dx&=\frac{Na}{\sqrt{2\pi}}\int_{-\infty}^{\infty}e^{-y^2}e^{-i(k-k_0)(ay+x_0))}dy\\\\ &=\frac{Na}{\sqrt{2\pi}}e^{-i(k-k_0)x_0}\int_{-\infty}^{\infty}e^{-y^2}e^{-i(k-k_0)ay}dy\tag 1 \end{align}$$
Now, let's complete the square on the exponent by writing
$$y^2+i(k-k_0)ay=(y-\frac12i(k-k_0)a)^2+\frac{(k-k_0)a^2}{4}\tag 2$$
Substituting $(2)$ into $(1)$ reveals
$$\begin{align} \frac{Na}{\sqrt{2\pi}}e^{-i(k-k_0)x_0}\int_{-\infty}^{\infty}e^{-y^2}e^{-i(k-k_0)ay}dy&=\frac{Na}{\sqrt{2\pi}}e^{-i(k-k_0)x_0}\int_{-\infty}^{\infty}e^{-(y-\frac12i(k-k_0)a)^2}e^{-\frac{(k-k_0)a^2}{4}}dy\\\\ &=\frac{Na}{\sqrt{2\pi}}e^{-i(k-k_0)x_0}e^{-\frac{(k-k_0)a^2}{4}}\int_{-\infty}^{\infty}e^{-(y-\frac12i(k-k_0)a)^2}dy\\\\ &=\frac{Na}{\sqrt{2\pi}}e^{-i(k-k_0)x_0}e^{-\frac{(k-k_0)a^2}{4}}\int_{-\infty}^{\infty}e^{-y^2}dy\\\\ &=\frac{Na}{\sqrt{2\pi}}e^{-i(k-k_0)x_0}e^{-\frac{(k-k_0)a^2}{4}}\sqrt{\pi}\\\\ &=\frac{Na}{\sqrt{2}}e^{-i(k-k_0)x_0}e^{-\frac{(k-k_0)a^2}{4}} \end{align}$$