The present invention relates to compounds of the formula I, the N-oxides, tautomers, the prodrugs and the pharmaceutically acceptable salts thereof, where in formula I the variables R1, R2, R3, R4 and R5 are as defined in the claims and where X is C-R6 or N,Y is C-R7 or N, where R6 and R7 are, inter alia, hydrogen, halogen, alkoxy, haloalkoxy and the like. The compounds of the formula I, the N-oxides, tautomers,the prodrugs and the pharmaceutically acceptable salts thereof are inhibitors of phosphodiesterase type 10A and to their use for the manufacture of a medicament and which thus are suitable for treating or controlling of medical disorders selected from neurological disorders and psychiatric disorders, for ameliorating the symptoms associated with such disorders and for reducing the risk of such disorders.