from sys import stdin from sys import stdout def main(inp, inps, put): N, Q = map(int, inp().split()) L, R = list(zip(*map(lambda x: list(map(int, x.split())), inps()))) result = [0]*Q bits = [1]*(N+2) now_sum = 0 for i, (l, r) in enumerate(zip(L, R)): for j in range(l, r+1): now_sum += bits[j] bits[j] *= -1 result[i] = now_sum put("\n".join(map(str, result))) main(stdin.readline, stdin.readlines, stdout.write)