from itertools import accumulate n, h = map(int, input().split()) d = [0] * (10 ** 6 + 1) for _ in range(n): a, b = map(int, input().split()) d[a] += 1 d[b+1] -= 1 ans = max(accumulate(d)) print(ans)