n, q = map(int, input().split()) A = list(map(int, input().split())) C = [0]*(n+1) for i, a in enumerate(A): C[i+1] = C[i]^a for i in range(q): l, r = map(int, input().split()) l, r = l-1, r-1 print(C[r+1]^C[l])