N,Q = list(map(int,input().split()))
L = [0] * (N+1)
R = [0] * (N+1)
for i in range(Q):
    L[i],R[i] = list(map(int,input().split()))
lamp = [0] * (N+1)
count = 0
for i in range(Q):
    for j in range(L[i],R[i] + 1):
        if lamp[j] == 1:
            count -= 1
            lamp[j] = 0
        else:
            count += 1
            lamp[j] = 1
    print(count)