#ifdef YONIHA #include #else #include #include #endif using namespace std; using namespace atcoder; #define int long long #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for(int i = (int)(n - 1); i >= 0; i--) template bool chmax(T &a,const T &b){if(a bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;} using vi = vector; using vvi = vector>; using vb = vector; using vvb = vector>; using vs = vector; using pii = pair; /* using mint = modint; using vm = vector; using vvm = vector>; */ signed main(){ int n, h; cin >> n >> h; priority_queue, greater<>> q; while(n--){ int a, b; cin >> a >> b; q.emplace(2 * a); q.emplace(2 * b + 1); } int ans = 0, cnt = 0; while(!q.empty()){ int t = q.top(); q.pop(); if(t % 2) cnt--; else cnt++; chmax(ans, cnt); } cout << ans << endl; }