A compound of formula wherein ZisCHorN; G is a group of formula wherein A is a phenyl ring or a 5 -12 membered heterocyclic ring, and R 1 is H, C 1-7 alkyl, C 3-7 cycloalkyl, C 3-7 cycloalkyl C 1-7 alkyl, C 1-7 alkoxy, C 1-7 alkyl carbonyl, amino, hydroxy, hydroxy C 1-7 alkyl, C 1-7 alkylamino C 1-7 alkyl, phenyl C 1-7 alkoxy, -NHC -R 21, -R 12 -C -R 13, -SO 2 -R 14 or -E-R 6, and R 2 is H, halogen, C 1-7 alkyl or oxo; B is a 5-12 membered carbocyclic or heterocyclic ring; R 3 is H, halogen, C 1-7 alkyl, C 1-7 alkoxy, cyano or an optionally substituted 5-6 membered heterocyclic ring; R 4 is H, halogen, C 1-7 alkyl or oxo; M is hydroxyl, C 1-7 alkyl or -NHR 5; R 5 is H, -C R 7, -SO 2 R 8, -C -D-R 9 or an optionally substituted 5-6 membered heterocyclic ring; R 6 is an optionally substituted 5-6 membered heterocyclic ring; R 7 is C 1-7 alkyl, C 2-7 alkenyl, C 3-7 cycloalkyl, C 1-7 alkoxy, C 1-7 alkoxy C 1-7 alkyl, carboxy C 1-7 alkyl, C 1-7 alkoxy carbonyl C 1-7 alkyl, C 1-7 alkylamino C 1-7 alkyl, -NH-R 10 or-NH-X 1 -R 11; R 8 is C 1-7 alkyl, C 2-7 alkenyl, C 3-7 cycloalkyl, hydroxy C 1-7 alkyl, -NR 18 R 19, -NH-X 2 -R 20, phenyl or an optionally substituted 5-6 membered heterocyclic ring; R 9 is phenyl or an optionally substituted 5-6 membered heterocyclic ring; R 10 is C 1-7 alkyl or C 3-7 cycloalkyl; R 11 is phenyl or an optionally substituted 5-6 membered heterocyclic ring; R 12 and R 21 are C 1-7 alkyl; R 13 is C 1-7 alkoxy, amino or hydroxy; R 14 is C 1-7 alkyl or C 3-7 cycloalkyl; R 18 and R 19 are, independently, H, C 1-7 alkyl or C 3-7 cycloalkyl; R 20 is phenyl or an optionally substituted 5-6 membered heterocyclic ring; E is a bond or a C 1-7 alkyl; D is a bond or a C 1-7 alkyl; X 1 and X 2 are, independently, a bond or C 1-7 alkyl; and pharmaceutically acceptable salts thereof. ZisCHorN; G is a group of formula wherein A is a phenyl ring or a 5 -12 membered heterocyclic ring, and R 1 is H, C 1-7 alkyl, C 3-7 cycloalkyl, C 3-7 cycloalkyl C 1-7 alkyl, C 1-7 alkoxy, C 1-7 alkyl carbonyl, amino, hydroxy, hydroxy C 1-7 alkyl, C 1-7 alkylamino C 1-7 alkyl, phenyl C 1-7 alkoxy, -NHC -R 21, -R 12 -C -R 13, -SO 2 -R 14 or -E-R 6, and R 2 is H, halogen, C 1-7 alkyl or oxo; B is a 5-12 membered carbocyclic or heterocyclic ring; R 3 is H, halogen, C 1-7 alkyl, C 1-7 alkoxy, cyano or an optionally substituted 5-6 membered heterocyclic ring; R 4 is H, halogen, C 1-7 alkyl or oxo; M is hydroxyl, C 1-7 alkyl or -NHR 5; R 5 is H, -C R 7, -SO 2 R 8, -C -D-R 9 or an optionally substituted 5-6 membered heterocyclic ring; R 6 is an optionally substituted 5-6 membered heterocyclic ring; R 7 is C 1-7 alkyl, C 2-7 alkenyl, C 3-7 cycloalkyl, C 1-7 alkoxy, C 1-7 alkoxy C 1-7 alkyl, carboxy C 1-7 alkyl, C 1-7 alkoxy carbonyl C 1-7 alkyl, C 1-7 alkylamino C 1-7 alkyl, -NH-R 10 or-NH-X 1 -R 11; R 8 is C 1-7 alkyl, C 2-7 alkenyl, C 3-7 cycloalkyl, hydroxy C 1-7 alkyl, -NR 18 R 19, -NH-X 2 -R 20, phenyl or an optionally substituted 5-6 membered heterocyclic ring; R 9 is phenyl or an optionally substituted 5-6 membered heterocyclic ring; R 10 is C 1-7 alkyl or C 3-7 cycloalkyl; R 11 is phenyl or an optionally substituted 5-6 membered heterocyclic ring; R 12 and R 21 are C 1-7 alkyl; R 13 is C 1-7 alkoxy, amino or hydroxy; R 14 is C 1-7 alkyl or C 3-7 cycloalkyl; R 18 and R 19 are, independently, H, C 1-7 alkyl or C 3-7 cycloalkyl; R 20 is phenyl or an optionally substituted 5-6 membered heterocyclic ring; E is a bond or a C 1-7 alkyl; D is a bond or a C 1-7 alkyl; X 1 and X 2 are, independently, a bond or C 1-7 alkyl;