AMC 10B 2022 (Problem 21)

Let P(x)P(x) be a polynomial with rational coefficients such that when P(x)P(x) is divided by x2+x+1x^2 + x + 1, the remainder is x+2x + 2, and when P(x)P(x) is divided by x2+1x^2 + 1, the remainder is 2x+12x + 1. There is a unique polynomial of least degree with these two properties. What is the sum of the squares of the coefficients of that polynomial?
(A)  10\text{(A)}\;10(B)  13\text{(B)}\;13(C)  19\text{(C)}\;19(D)  20\text{(D)}\;20(E)  23\text{(E)}\;23