import sys def input(): return sys.stdin.readline().strip() def mapint(): return map(int, input().split()) sys.setrecursionlimit(10**9) N, M = mapint() now, time = 0, 0 for _ in range(M): t, p = mapint() if t-time