#include #include #include #include #include #include #include // #include "Src/Utility/BinarySearch.hpp" // #include "Src/Sequence/CompressedSequence.hpp" // #include "Src/Sequence/RunLengthEncoding.hpp" // using namespace zawa; // #include "atcoder/modint" // using mint = atcoder::modint998244353; int N, H; int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); std::cout.tie(nullptr); std::cin >> N >> H; std::vector imos(H + 1); for (int i = 0 ; i < N ; i++) { int A, B; std::cin >> A >> B; imos[A]++; imos[B + 1]--; } for (int i = 1 ; i <= H ; i++) imos[i] += imos[i - 1]; std::cout << *std::max_element(imos.begin(), imos.end()) << '\n'; }