K shell excitation of nitrogen and carbon monoxide by electron impact