#include #include #include using namespace std; using ll = long long; int main(void){ ll n, m; cin >> n >> m; vector day; for(int i=0; i> a >> b; ll x=(m-a+b-1)/b; x--; if(b*x==m) x++; day.push_back(x); } sort(begin(day), end(day)); //for(auto p:day) cout << p << ' '; cout << endl; int left=0, right=n; auto judge=[&](int x){ if(x==0) return false; int r=x-1, c=0; while(r(r, n-1); c++; } return true; }; while(right-left>1){ int mid=(left+right)/2; if(judge(mid)) right=mid; else left=mid; } cout << right << endl; return 0; }