The present invention provides a substituted amide compound which is useful asan active ingredient of a pharmaceutical composition, in particular, apharmaceuticalcomposition for treating diseases caused by lysophosphatidic acid (LPA).(see formula I)(whereinA is aryl which may be substituted, etc,B is a 5-membered aromatic hetero ring group which may be substituted,X is a single bond or -(CR X1R X2)n-,n is 1, 2, 3, or 4,R X1 and R X2 are hydrogen, etc.,Y1 to Y5 are CR Y or N,R Y's are hydrogen, etc.,R1 and R2 are hydrogen, etc.,m is 1, 2, or 3,R3 is hydrogen, etc.,R4 is lower alkyl which may be substituted, etc.)