Given that f(x)=x^3-kx^2-2x+1 gives a remainder k when divided by x-k,find the value of k

Given that f(x)=x^3-kx^2-2x+1 gives a remainder k when divided by x-k,find the value of k