a, m = input().spilt(' ') a, m = int(a), int(m) for i in range(m): b = int(input()) - int(input()) a = a - b - 1 print(a)