Mechanisms for Energy Shifts in Atomic $K$ X-ray Spectra