N,Q=map(int,input().split()) a=[0]+[int(x) for x in input().split()] for i in range(1,N+1): a[i]^=a[i-1] for i in range(Q): l,r=map(int,input().split()) print(a[r]^a[l-1])