Solve for q k=-q/p+1