n, h = map(int, input().split()) t = [0] * 10**6 for _ in range(n): l, r = map(int, input().split()) t[l] += 1 t[r + 1] -= 1 ans, now = 0, 0 for i in range(h + 5): now += t[i] ans = max(ans, now) print(ans)