The present invention relates to a process for preparing a compound of the formula
wherein b, Y and R3 are defined as above, useful for preparing novel aralkyl and aralkylidene heterocyclic lactams and imides which are selective agonists and antagonists of serotonin 1 (5-HT1) receptors.