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