n, q = map(int, input().split())
sum = 0
a = []
for i in range(0, n):
    a.append(0)
for i in range(0, q):
    l, r = map(int, input().split())
    l -= 1
    for j in range(l, r):
        if a[j] == 0:
            a[j] = 1
            sum += 1
        else:
            a[j] = 0
            sum -= 1
    print(sum)