N,Q = map(int,input().split()) A = [0]+list(map(int,input().split())) B = [0]*(N+1) for i in range(1,N+1): B[i] = A[i]^B[i-1] for _ in range(Q): l,r = map(int,input().split()) print(B[r]^B[l-1])