Now for the other direction:
-------
Lemma: Given
=1 )
, suppose

is the smallest number greater than

such that

and

where

, then

.
Proof: By the division algorithm,

where

. So we then get
^q\cdot a^d \equiv 1\cdot a^d=a^d\bmod{p} )
. Since

and

, by the minimality of

this forces

. So we see that

.
-------
Suppose

is solvable. This implies
^{-1}\cdot x^2=\left(xa^{-1}\right)^2\equiv-1\bmod{p}\implies y^2\equiv-1\bmod{p} )
is solvable. So observe that it's equivalent to show

solvable implies

.
Since

is odd,

, so we have the following:
So as you can see,

is the smallest exponent greater than

such that

. Now by Fermat's little theorem, since
=1\implies x^{p-1}\equiv1\bmod{p} )
. By our above Lemma, this implies

.