error checking the length of K before testing the validity of the prior