A compound of formula (Ia): ** Formula ** or a pharmaceutically acceptable salt thereof, in which: n is 0, 1 or 2; m is 0, 1 or 2; Y is selected from the group consisting of>; = C (R6) - and>; = N-; R1 is selected from the group consisting of hydrogen, alkyl, alkenyl, alkynyl, haloalkyl, haloalkenyl, haloalkenyl, optionally substituted cycloalkyl, optionally substituted cycloalkylalkyl, optionally substituted cycloalkylalkyl, optionally substituted aryl, optionally substituted aralkyl, optionally substituted aralkyl , optionally substituted aralkynyl, -R8-C (O) OR6, -R9-N (R6) R7 and -R8-OR6; each R2, when present, is independently selected from the group consisting of optionally substituted alkyl, halo, cyano and -OR6; each R3, when present, is independently selected from the group consisting of alkyl, halo and haloalkyl; R4 is selected from the group consisting of aryl and heteroaryl, where aryl and heteroaryl are each independently optionally substituted with one or more substituents selected from the group consisting of oxo, alkyl, halo, haloalkyl, cyano, N-heterocyclyl , N-heteroaryl, aryl, -R8-OR6a, -R8-S (O) pR6a (where p is 0, 1 or 2), -R8-C (O) R6a, -R8-C (O) OR6a, - R8-C (O) N (R6a) R7a, -R8-N (R6a) R7a, -R8-N (R6a) -R9-N (R6a) R7a, R8-N (R6a) -R9-OR7a, -R6 -N (R6a) C (O) R7a, -R6-N (R6a) S (O) 2R7a, -R8-N (R6a) C (O) -R8-N (R6a) R7a and -R8-N (R6a ) -R9- N (R6a) S (O) 2R7a, where each R6a and R7a is independently selected from the group consisting of hydrogen, alkyl, optionally substituted cycloalkyl, optionally substituted heterocyclyl, optionally substituted heterocyclyl alkyl, optionally substituted heteroaryl and optionally aralkyl substituted, and where Nheterocyclyl, N-heteroaryl and aryl are each independently optionally substituted with one or more substituents selected from the group consisting of -C (O) R6, -R8-N (R6) R7, -R8-C (O) N (R6) R7, alkyl, halo and optionally substituted aryl; R5 is an N-heterocyclyl, in which a nitrogen atom in th