An agricultural or horticultural fungicide contains as an active ingredient thereof at least one compound selected from the group consisting of nitrogenated heterocyclic compounds represented by formula (I) (wherein, R represents a group represented by CR1R2R3 or a cyano group, R1 to R3 represent hydrogen atoms, alkyl groups or hydroxyl groups, or the like, X1 represents a halogeno group or the like, m represents an integer of 0 to 5, X2 represents a halogeno group or the like, n represents an integer of 0 to 3, B represents a carbon atom or a nitrogen atom, D represents a 5- to 7-membered hydrocarbon ring, and A1 to A4 represent carbon atoms or nitrogen atoms, provided that A1 to A4 do not all represent carbon atoms when B represents a carbon atom) and salts thereof.