import io import sys from collections import defaultdict, deque, Counter from itertools import permutations, combinations, accumulate from heapq import heappush, heappop from bisect import bisect_right, bisect_left from math import gcd import math from itertools import product _INPUT = """\ 6 5 3 0 0 0 0 0 1 5 2 4 3 3 10 7 1 0 1 1 1 1 0 0 1 1 3 6 1 10 4 4 1 7 3 3 2 10 8 8 30 24 1 0 1 1 1 1 0 0 1 1 0 1 0 1 1 0 0 0 0 0 1 0 1 1 0 0 0 1 1 1 30 30 13 25 30 30 14 24 2 16 10 28 22 24 15 24 9 29 6 26 24 29 2 15 27 28 3 21 17 20 16 16 15 22 27 28 17 28 14 28 25 28 13 22 15 22 15 27 """ def input(): return sys.stdin.readline()[:-1] def solve(test): N,Q=map(int, input().split()) A=list(map(int, input().split())) ans=[A[0]] for i in range(1,N): ans.append(A[i-1]^A[i]) # print(ans) for _ in range(Q): L,R=map(int, input().split()) L-=1 ans[L]^=1 if R