II. (40 points) Let $p$ be a prime number, and the sequence $\left\{a_{n}\right\}$ satisfies $a_{0}=0, a_{1}=1$, and for any non-negative integer $n$,
$$
a_{n+2}=2 a_{n+1}-p a_{n} \text {. }
$$

If -1 is a term in the sequence $\left\{a_{n}\right\}$, find all possible values of $p$.