Scattering of CO and N2 molecules by a graphite surface