Let $p$ be an odd prime and $a_1, a_2,...,a_p$ be integers. Prove that the following two conditions are equivalent:
$1)$ :There exists a polynomial $P(x)$ with degree $\leq \frac{p-1}{2}$ such that $P(i) \equiv a_i \pmod p$ for all $1 \leq i \leq p$
$2):$ foy any integer $k(0\le k\le \dfrac{p-3}{2})$,we have $$\sum_{i=1}^{p}a_{i}i^k\equiv 0\pmod p$$
This problem is from when I deal 2015CMO3 problem at last step.seelinks
I think use this well konwn $$\sum_{i=1}^{p}i^m\equiv 0\pmod p,0\le m<p-1,m\in Z$$ and $$\sum_{i=1}^{p}i^m\equiv 1+1+\cdots+1=-1\pmod p,m=p-1,m\in Z$$
also see: Polynomial interpolating sequence mod p has small degree
But I can't it.Thanks