Polynomial $x^7+x^2+1$ has higher term coefficient $1$ and also constant term coefficient $1$.
Thus if we divide it by a polynomial of degree $5$ of the form $(x^5+\cdots+1)$ as $A,B,C,D$ proposition are, it will be $x^2+ax+1$, only the central coefficient is unknown, the other two are forced to $1$.
If you multiply this polynomial by $B$ or $C$ $\begin{cases}(x^2+ax+1)(x^5+x^4+1)\\(x^2+ax+1)(x^5+x^4+x^3+x^2+1)\end{cases}$
you can notice that there will be an unremovable (and not desired) term in $x^4$, thus these possibilities should be excluded.
So you have to decide between $A$ and $D$ $\begin{cases}(x^2+ax+1)(x^5-x^4+x^2-x+1)\\(x^2+ax+1)(x^5-x^4+x^2+x+1)\end{cases}$
In both case we have $(a-1)x^6$ therefore $a=1$ to get rid of it.
The term in $x^1$ is also easy to get $A:(a-1)x=0$ and $D:(a+1)x=2x$, and since there should be no term in $x$, then $D$ should be excluded.
You just need to verify that $A$ works via a final expansion, which is indeed the case.