Ionization of N2 and CO by 10 keV electrons as a function of the energy loss: II. Inner-shell electrons