n, m = map(int, input().split())

g = [0] * (n+2)
for i in range(m):
    l,r = map(int,input().split())
    g[l] += 1
    g[r+1] -= 1

now = 0
ans = 0
for i in range(1, n+1):
    now += g[i]
    if now >= m:
        ans += 1

print(ans) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m g = [0] * (n+2) g [0] * (n+2) [0] 0 n+2 n 2 for i in range(m):
    l,r = map(int,input().split())
    g[l] += 1
    g[r+1] -= 1 i range(m) range m l,r = map(int,input().split()) l map(int,input().split()) map int input().split() ().split () input split r g[l] += 1 g[l] g l 1 g[r+1] -= 1 g[r+1] g r+1 r 1 1 now = 0 now 0 ans = 0 ans 0 for i in range(1, n+1):
    now += g[i]
    if now >= m:
        ans += 1 i range(1, n+1) range 1 n+1 n 1 now += g[i] now g[i] g i if now >= m:
        ans += 1 now >= m now m ans += 1 ans 1 print(ans) print ans m = map(int, input().split()) map(int, input().split()) m l,r = map(int,input().split()) map(int,input().split()) l ans = 0 0 ans r = map(int,input().split()) map(int,input().split()) r now = 0 0 now now += g[i] g[i] now n, m = map(int, input().split()) map(int, input().split()) n g = [0] * (n+2) [0] * (n+2) g ans += 1 1 ans
n, m = map(int, input().split())

g = [0] * (n+2)
for i in range(m):
    l,r = map(int,input().split())
    g[l] += 1
    g[r+1] -= 1

now = 0
ans = 0
for i in range(1, n+1):
    now += g[i]
    if now >= m:
        ans += 1

print(ans)
