Compounds of Formula (I) (wherein variables A1, A2, A3, ring-B, m, n, J, E1, E2, E3, R5, RPG and Y are as described herein), which are useful as antagonists of CGRP receptors, and useful in the treatment or prevention of diseases in which CGRP receptors are involved, such as headache, and in particular migraine and cluster headache. The invention is also directed to pharmaceutical compositions comprising the compounds of formula (I) and the use of these compounds and compositions in the prevention or treatment of diseases in which CGRP receptors are involved.