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