Aims. We are studying the extremely young cluster of M 17 to investigate the birth of high-mass stars and the initial mass function. Methods. Deep JHKL imaging and K-band spectroscopy from the VLT of 201 stars toward the cluster is presented. Results. The majority of 104 stars show the CO band-head in absorption. Half of them emit X-rays and/or have infrared excess, indicative of very young objects. Their intrinsic IR luminosity is compatible with intermediate and high-mass pre-main sequence stars. Nine additional stars have the CO feature in emission, while sixty sources are lacking any stellar spectral feature due to veiling by circumstellar dust. Conclusions. We suggest that CO absorption is - as in the case of low-mass stars - also a common feature during the early evolution of stars with higher masses. According to model calculations the observed CO absorption is most likely a sign of heavily accreting protostars with mass accretion rates above 10 -5 Moyr -1 .