Compounds that are antagonists of the VR1 receptor, having formula (I) or a pharmaceutically acceptable salt thereof, wherein A1, A2, A3, A4, R7, R8, R9, X, Y, Z, L, n, and m, are as defined herein, and are useful in disorders prevented or ameliorated by inhibiting the VR1 receptor.