from itertools import accumulate N,H = map(int,input().split()) X = [0] * (H + 1) for _ in range(N): a,b = map(int,input().split()) X[a] += 1 X[b+1] -= 1 X = list(accumulate(X)) print(max(X))