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