  We use first-principles calculations to investigate the adsorption and
incorporation of non-metal impurities (N, C) at the anatase
TiO$_2$(001)-(1$\times$4) reconstructed surface. We analyze in detail the
influence of the surface structure and local strain on the impurity binding
sites and incorporation pathways and identify important intermediates which
facilitate impurity incorporation. We find various subsurface interstitial
binding sites and corresponding surface $\rightarrow$ subsurface penetration
pathways on the reconstructed surface. This surface also favors the presence of
subsurface oxygen-vacancies, to which adsorbed species can migrate to form
substitutional impurities. Most notably, we show that the non-exposed oxygen
sites just below the surface have a key role in the incorporation of nitrogen
and carbon in TiO$_2$(001).
