N, H = map(int, input().split()) streams = [] for _ in range(N): A, B = map(int, input().split()) streams.append((A, 1)) streams.append((B + 0.5, -1)) streams.sort(key=lambda x: x[0]) watching = 0 ans = 0 for time, diff in streams: watching += diff ans = max(ans, watching) print(ans)