The present invention relates to compounds of formula (I) wherein R1 is hydrogen, lower alkyl, halogen, lower alkyl substituted by halogen, lower alkoxy, lower alkoxy substituted by halogen, cyano, nitro, C3-6-cycloalkyl, -CH2-C3-6-cycloalkyl, -O-CH2-C3-6-cycloalkyl, -O-(CH2)2-O-lower alkyl, S(O)2CH3, SF5, -C(O)NH-lower alkyl, phenyl, -O-pyrimidinyl, optionally substituted by lower alkoxy substituted by halogen, or is benzyl, oxetanyl or furanyl; m Ar is aryl or heteroaryl, selected from the group consisting of phenyl, naphthyl, pyrimidinyl, pyridinyl, benzothiazolyl, quinolinyl, quinazolinyl, benzo[d][1.3]dioxolyl, 5,6,7,8- tetrahydro-quinazolinyl, pyrazolyl, pyrazinyl, pyridazinyl, or 1,3,4-oxadiazolyl; Y is a bond, -CH2-, -CH2CH2-, -CH(CF3)- or -CH(CH3)-; R2 is hydrogen or lower alkyl; A is CR or N; and R is hydrogen, cyano, halogen or lower alkyl; R' is hydrogen or halogen; with the proviso that when R' is halogen, then A is CH; B is CH or N; n is 0, 1 or 2; X is a bond, -CH2- or -O-; pharmaceutical active acid addition salts thereof. It has now been found that the compounds of formula I have a good affinity to the trace amine associated receptors (TAARs), especially for TAAR1. The compounds may be used for the treatment of depression, anxiety disorders, bipolar disorder, attention deficit hyperactivity disorder (ADHD), stress-related disorders, psychotic disorders such as schizophrenia, neurological diseases such as Parkinson's disease, neurodegenerative disorders such as Alzheimer's disease, epilepsy, migraine, hypertension, substance abuse and metabolic disorders such as eating disorders, diabetes, diabetic complications, obesity, dyslipidemia, disorders of energy consumption and assimilation, disorders and malfunction of body temperature homeostasis, disorders of sleep and circadian rhythm, and cardiovascular disorders.