The photons have momentum as well as energy, and the momentum had to be ℏ ℏ k where k is the wavenumber of the electromagnetic wave. This is required by relativity, because the momentum and energy form a four-vector, as do the frequency and wave-number.