n, q = map(int, input().split()) alst = list(map(int, input().split())) ans = [0] for a in alst: ans.append(ans[-1] ^ a) for _ in range(q): l, r = map(int, input().split()) print(ans[r] ^ ans[l - 1])