use the basic theorem
"If a polynomial f(x) be divided by (x - a), the remainder is f(a)."
so we hav f(1)=2 and f(2)=1
now,f(x)= p(x)*(x-1)(x-2) + r(x) ;(r(x) is remainder,also degree of r(x)< degree of p(x) )
put x=1; f(1)= r(1)=2
x=2; f(2)=r(2)=1
so...