When kx^3+px^2-x+3 is divided by x-1, the remainder is 4. When kx^3+px^2-x+3 is divided by x-2, the remainder is 21. Find the values of k and p.