 The first is palladium migration from carbon-3 to carbon-2 along with the expulsion of carbon dioxide.This forms the aryl–palladium–heteroatom intermediate, which undergoes reductive elimination to form the final heteroaromatic compound.The second pathway only occurs when R is a proton.