Let $p$ be an odd prime. Consider the numbers $$2 \cdot 1,2 \cdot 2,\dots,2\cdot \frac{1}{2}(p-1) $$
and let $k$ be the largest integer that satsifies $$2k \le \frac{1}{2}(p-1)$$
Prove that if $l \in \mathbb{Z}$ satisfies $k \lt l \lt \frac{1}{2}(p-1)$ then $2l-p$ is negative and is the least residue of $2l$. Deduce that $$\left(\frac{2}{p}\right)=(-1)^{\frac{1}{2}(p-1)-k}$$
I feel like i need to use Gauss' lemma but i'm not sure how i would show that the number of numbers with negative least residue is equal to $\frac{1}{2}(p-1)-k$