A compound of formula, or a pharmaceutically acceptable salt thereof: wherein: each occurrence of A is independently selected from -CH= and -N=, provided that at least one A is -C=; n is 1; p is 0 or 1; M is selected from -O- and -CR a R b -, each of R a and R b is independently selected from H, halogen, -OH and -C 1-6 alkyl; R 1 is selected from: phenyl, and a 5-6 membered monocyclic heterocyclyl containing one to three heteroatoms independently selected from N, O, and S; wherein each of the phenyl of and the mono-cyclic heterocyclyl of is optionally substituted with 1-3 substituents independently selected from: (a) halogen, (b) -C 3-6 cycloalkyl optionally substituted with -OH, (c) -CN, (d) -O-C 1-6 alkyl, optionally substituted with 1-3 halogens, (e) -O-C 3-6 cycloalkyl, (f) -C 1-6 alkyl, optionally substituted with 1-4 substituents independently selected from halogen, -OH, and -S 2 -C 1-6 alkyl, (g) -NH-S 2 -R c, wherein R c is selected from -C 1-6 alkyl and -C 3-6 cycloalkyl, (h) -C -OH, and (i) a 5-6 membered monocyclic ring containing one to three heteroatoms independently selected from N, O, and S, optionally substituted with -C 1-6 alkyl; R 2 is selected from: C 3-6 carbocyclyl, and aryl; wherein each of the C 3-6 carbocyclyl of, and the aryl of is optionally substituted with 1-3 substituents independently selected from: (a) halogen, (b) -C 3-6 cycloalkyl, (c) -CN, (d) -O-C 1-6 alkyl, optionally substituted with 1-3 halogens, and (e) -C 1-6 alkyl, optionally substituted with 1-3 substituents independently selected from halogen, -OH, and -NH 2; and R 3 is selected from H and halogen. each occurrence of A is independently selected from -CH= and -N=, provided that at least one A is -C=; n is 1; p is 0 or 1; M is selected from -O- and -CR a R b -, each of R a and R b is independently selected from H, halogen, -OH and -C 1-6 alkyl; R 1 is selected from: phenyl, and a 5-6 membered monocyclic heterocyclyl containing one to three heteroatoms independently selected from N, O, and S; wherein each of the phenyl of and the mono-cyclic heterocyclyl of is optionally substituted with 1-3 substituents independently selected from: (a) halogen, (b) -C 3-6 cycloalkyl optionally substituted with -OH, (c) -CN, (d) -O-C 1-6 alkyl, optionally substituted with 1-3 halogens, (e) -O-C 3-6 cycloalkyl, (f) -C 1-6 alkyl, optionally substituted with 1-4 substituents independently selected from halogen, -OH, and -S 2 -C 1-6 alkyl, (g) -NH-S 2 -R c, wherein R c is selected from -C 1-6 alkyl and -C 3-6 cycloalkyl, (h) -C -OH, and (i) a 5-6 membered monocyclic ring containing one to three heteroatoms independently selected from N, O, and S, optionally substituted with -C 1-6 alkyl; phenyl, and a 5-6 membered monocyclic heterocyclyl containing one to three heteroatoms independently selected from N, O, and S; (a) halogen, (b) -C 3-6 cycloalkyl optionally substituted with -OH, (c) -CN, (d) -O-C 1-6 alkyl, optionally substituted with 1-3 halogens, (e) -O-C 3-6 cycloalkyl, (f) -C 1-6 alkyl, optionally substituted with 1-4 substituents independently selected from halogen, -OH, and -S 2 -C 1-6 alkyl, (g) -NH-S 2 -R c, wherein R c is selected from -C 1-6 alkyl and -C 3-6 cycloalkyl, (h) -C -OH, and (i) a 5-6 membered monocyclic ring containing one to three heteroatoms independently selected from N, O, and S, optionally substituted with -C 1-6 alkyl; R 2 is selected from: C 3-6 carbocyclyl, and aryl; wherein each of the C 3-6 carbocyclyl of, and the aryl of is optionally substituted with 1-3 substituents independently selected from: (a) halogen, (b) -C 3-6 cycloalkyl, (c) -CN, (d) -O-C 1-6 alkyl, optionally substituted with 1-3 halogens, and (e) -C 1-6 alkyl, optionally substituted with 1-3 substituents independently selected from halogen, -OH, and -NH 2; and C 3-6 carbocyclyl, and aryl; (a) halogen, (b) -C 3-6 cycloalkyl, (c) -CN, (d) -O-C 1-6 alkyl, optionally substituted with 1-3 halogens, and (e) -C 1-6 alkyl, optionally substituted with 1-3 substituents independently selected from halogen, -OH, and -NH 2; and R 3 is selected from H and halogen.