Let M and N be positive integers with M > N. The division algorithm for Z implies that

there exist integers Q and R such that M = QN + R, where 0=<R<N. The division algorithm for $\displaystyle \mathbb{R}[x]$ tells us that there exist polynomials q and r such that

x^M -1=q(x^N-1)+r, where r = 0 or deg r < N.

Find q and r.

I understand the division algorithm, but am not quite sure how to go about finding q and r. Help please!