import java.util.*; public class Main { static final int MOD = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int q = sc.nextInt(); int[] xors = new int[n + 1]; for (int i = 1; i <= n; i++) { xors[i] = xors[i - 1] ^ sc.nextInt(); } StringBuilder sb = new StringBuilder(); for (int i = 0; i < q; i++) { sb.append(xors[sc.nextInt() - 1] ^ xors[sc.nextInt()]).append("\n"); } System.out.print(sb); } }