Function to find largest integer greater than K.