#include using namespace std; using ll = long long; int main() { int N, H; cin >> N >> H; vector> v; for (int i = 0; i < N; i++) { int a, b; cin >> a >> b; b++; v.emplace_back(a, false); v.emplace_back(b, true); } sort(v.begin(), v.end()); int p = 0; int current = 0; int ans = 0; while (p < v.size()) { pair f = v[p++]; if (f.second) current--; else current++; while (p < v.size() && v[p].first == f.first) { if (v[p].second) current--; else current++; p++; } ans = max(ans, current); } cout << ans << endl; }