N,H = map(int, input().split())
accu = [0] * (H+1)
for i in range(N):
    A,B = map(int, input().split())
    accu[A] += 1
    accu[B+1] -= 1
#rint(accu)
from itertools import accumulate

accu = list(accumulate(accu))
print(max(accu))