class Fenwick_Tree: def __init__(self, n): self.n = n self.data = [0] * (n + 1) def add(self, p, x): p += 1 while p <= self.n: self.data[p] ^= x p += p & -p def sum(self, l, r): '''範囲[l, r)(lからrまで)の総xorを求める''' return self._sum(r) ^ self._sum(l - 1) def _sum(self, r): '''範囲[0, r)(0からrまで)の総xorを求める''' s = 0 r += 1 while r > 0: s ^= self.data[r] r -= r & -r return s n, q = map(int, input().split()) A = list(map(int, input().split())) FT = Fenwick_Tree(n) for i in range(n): FT.add(i, A[i]) for _ in range(q): l, r = map(int, input().split()) print(FT.sum(l - 1, r - 1))