Compounds of the following formula:in which R1, R2, A1, A2, X, Y, m, n, p, x and y are as defined herein. Also disclosed are pharmaceutical compositions each containing one or more of these compounds, and use thereof in treating enteroviral infection.