To provide a GPR40 activating agent having as an active ingredient a novel compound having a GPR40 agonist action, a salt thereof, a solvate of the compound or salt, or the like in particular, an insulin secretagogue or an agent for preventing and/or treating diabetes, obesity, or the like. [Solution] A compound represented by formula (I) [Chemical formula 1] (in the formula, p is 0-4 j is 0-1 k is 0-2 the ring (A) is a heterocyclic group, cycloalkyl group, cycloalkenyl group, spiro ring group, or aryl group optionally substituted at the position (L) the ring (B) is an aryl group or a heteroaryl group X is O or -NR7- and R1-R7 and L represent specific groups), a salt thereof, or a solvate of the compound or salt.