K-shell energy loss spectra of 2.5 keV electrons in N2 and CO