Aims. We study the chemical complexity towards the central parts of the starburst galaxy M 82, and investigate the role of certain molecules as tracers of the physical processes in the galaxy circumnuclear region. Methods. We carried out a spectral line survey with the IRAM-30 m telescope towards the northeastern molecular lobe of M 82. It covers the frequency range between 129.8 GHz and 175.0 GHz in the 2 mm atmospheric window, and between 241.0 GHz and 260.0 GHz in the 1.3 mm atmospheric window. Results. Sixty-nine spectral features corresponding to 18 different molecular species are identified. In addition, three hydrogen recombination lines are detected. The species NO, H 2 S, H 2 CS, NH 2 CN, and CH 3 CN are detected for the first time in this galaxy. Assuming local thermodynamic equilibrium, we determine the column densities of all the detected molecules. We also calculate upper limits to the column densities of fourteen other important, but undetected, molecules, such as SiO, HNCO, or OCS. We compare the chemical composition of the two starburst galaxies M 82 and NGC 253. This comparison enables us to establish the chemical differences between the products of the strong photon-dominated regions driving the heating in M 82, and the large-scale shocks that influence the properties of the molecular clouds in the nucleus of NGC 253. Conclusions. Overall, both sources have different chemical compositions. Some key molecules highlight the different physical processes dominating both central regions. Examples include CH 3 CCH, c-C 3 H 2 , or CO + , the abundances of which are clearly higher in M 82 than in NGC 253, pointing at photodissociating regions. On the other hand, species such as CH 2 NH, NS, SiO, and HOCO + have abundances of up to one order of magnitude higher in NGC 253 than in M 82.