#include #include using namespace std; int N,H; int imos[1<<20]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin>>N>>H; for(;N--;) { int a,b;cin>>a>>b; imos[a]++; imos[b+1]--; } int ans=0; for(int i=0;i