Hint $\rm\,\ mod\ \ x^{\large A}\!-1\!:\ \ \color{#c00}{x^{\large A}\equiv 1},\ \ \, so\ \ \ \smash[b]{\underbrace{x^{\large B}\equiv x^{\large B\ mod\ A}}} \equiv 1 \!\iff\! B\ mod\ A = 0 \!\iff\! A\mid B$
$\text{since by division}\ \ \rm B = AQ+R\,\Rightarrow\, x^{\large B}\equiv (\color{#c00}{x^{\large A }})^{\large Q} x^{\large R}\equiv {\color{#c00}1}^{\large Q} x^{\large R}\equiv x^{\large R},\ $ for $\rm\, R = B\bmod A$
The method in the above proof is called modular order reduction. It works in any ring (or monoid) since it uses only ring (or monoid) laws and consequent congruence product & power rules.
If mod is unknown then we can instead use the Factor Theorem $\rm\,\color{#c00}z^Q-1 = (\color{#c00}z-1)q(x)$
$\ \ \rm (\color{#c00}{x^A}\!-1)q(x) = ((\color{#c00}{x^A})^Q\!-1) x^R = x^{AQ+R}\!-x^R,\ $ so $\rm\ x^{AQ+R}\!-1 = x^R\!-1 + (x^A\!-1)\, q(x)$
Remark $ $ We can show much more. The polynomial sequence $\rm\ f_n = (x^n-1)/(x-1),\, $ like the Fibonacci sequence, is a strong divisibility sequence, i.e. $\rm\: (f_m,f_n)\: =\: f_{\:(m,n)},\,$ where $\rm\,(a,b):=\gcd(a,b).\,$ The proof is simple - essentially the same as the proof of the Bezout identity for integers - see here. Thus we can view the polynomial Bezout identity as a q-analog of the integer Bezout identity, e.g.
$$\begin{align} \rm\ \color{#90f}3\, &=\, (\color{#0a0}{15},\ \color{#c00}{21})\\[.2em]
{\large \leadsto}\,\ \rm\ \color{#90f}{f_3}\, &=\, \rm (\color{#0a0}{f_{15}},\ \color{#c00}{f_{21}}),\, \ \text{with Bezout equation below}\\[.2em]
\color{#90f}{\frac{x^3-1}{x-1}} &= (x^{15}\! +\! x^9\! +\! 1)\ \color{#0a0}{\frac{x^{15}\!-1}{x-1}} - (x^9\!+\!x^3)\ \color{#c00}{\frac{x^{21}\!-1}{x-1}}\end{align}\ $$
For $\rm\, x = 1\, $ it specializes to $ \ \color{#90f}3\ =\ (3)\, \color{#0a0}{15}\, -\, (2)\, \color{#c00}{21},\, $ a Bezout equation in $\Bbb Z.\,$ It is well-worth mastering these binomial divisibility properties since they occur quite frequently in number theoretical applications and, moreover, they provide excellent motivation for the more general study of divisibility theory, $ $ esp. in divisor theory form. For an introduction see Borevich and Shafarevich: Number Theory.