Measurement of the diamagnetic Zeeman shift of potassium S and D Rydberg states