#include #include using namespace std; using namespace atcoder; // デバッグ用 #ifndef ONLINE_JUDGE #define _GLIBCXX_DEBUG #endif #define nall(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define YES cout << "Yes\n" #define NO cout << "No\n" #define YN {cout << "Yes\n";}else{cout << "No\n";} #define chmax(x, y) x = max(x, y) #define chmin(x, y) x = min(x, y) #define PRECISION(x) cout << fixed << setprecision(x) #define endl '\n' #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define each(o, a) for (auto &o : a) using ll = long long; using ld = long double; using ull = unsigned long long; template using vc = vector; template using vv = vc>; using vi = vc; using pii = pair; using pll = pair; using vl = vc; using vvl = vv; using vvvl = vv; const int MOD = 998244353; void solve() { ll n, h; cin >> n >> h; vl a(n), b(n), table(h+9); rep (i, n) { cin >> a[i] >> b[i]; table[a[i]]++; table[b[i] + 1]--; } ll ans = 0, tmp = 0; rep (i, h) { tmp += table[i]; chmax(ans, tmp); } cout << ans << endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); solve(); return 0; }