10. (20 points) Let the sequence of non-negative integers $\left\{a_{n}\right\}$ satisfy:
$$
a_{n} \leqslant n(n \geqslant 1) \text {, and } \sum_{k=1}^{n-1} \cos \frac{\pi a_{k}}{n}=0(n \geqslant 2) \text {. }
$$

Find all possible values of $a_{2021}$.
10. From the problem, we know
$$
a_{1}=1 \text {, and } \cos \frac{\pi a_{1}}{3}+\cos \frac{\pi a_{2}}{3}=0 \text {. }
$$

Then $a_{2}=2$.
We will use mathematical induction to prove $a_{n}=n(n>1)$.
Assume $a_{k}=k(k=1,2, \cdots, n-1)$, according to the condition we have
$$
\cos \frac{\pi a_{n}}{n+1}=-\sum_{k=1}^{n-1} \cos \frac{\pi k}{n+1} .
$$

Let $z=\cos \frac{\pi}{n+1}+\mathrm{i} \sin \frac{\pi}{n+1}$. Then
$$
z+z^{2}+\cdots+z^{n}=\frac{z-z^{n+1}}{1-z}=\frac{1+z}{1-z},
$$

and $\overline{\left(\frac{1+z}{1-z}\right)}=-\frac{1+z}{1-z}$.
Thus, $\operatorname{Re} \frac{1+z}{1-z}=0$.
Therefore, $\sum_{k=1}^{n} \cos \frac{\pi k}{n+1}=0$.
Hence, $\cos \frac{\pi a_{n}}{n+1}=\cos \frac{\pi n}{n+1}, a_{n} \leqslant n$, it must be that $a_{n}=n$.

Therefore, $a_{2021}=2021$.