#include using namespace std; using ll = long long; using vi = vector; using ii = pair; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); srand(1234); // seed to make deterministic int n; ll M; cin >> n >> M; vector ab(n); for (int i = 0; i < n; ++i) cin >> ab[i].first >> ab[i].second; ll best = 9e18; for (int rep = 0; rep < 500; ++rep) { ll A = 0LL, B = 0LL; for (int i = 0; i < n; ++i) if (rand()&1) A += ab[i].first, B += ab[i].second; if (A > 0LL) best = min(best, (M + B + A - 1LL) / A); } cout << best << endl; return 0; }