The invention relates to heteroarylpiperidine and -piperazine derivatives, to agrochemically active salts thereof, to their use and also to methods and compositions for controlling phytopathogenic harmful fungi in and/or on plants or in and/or on seed of plants, to methods for producing such compositions and to treated seed, and also to the use thereof for controlling phytopathogenic harmful plants in agriculture, horticulture and forestry, in animal health, in materials protection and also in the household and hygiene sector. The present invention further relates to a method for producing heteroarylpiperidine and -piperazine derivatives.