#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define FOR(i, n) for(int i = 0; i < n; i++)
#define pb push_back
#define MAXN 100000
using namespace std;
ld p[MAXN + 1];
ll k[MAXN + 1];
#define FILENAME "castle"
int main()
{
    freopen(FILENAME".in", "r", stdin);
    freopen(FILENAME".out", "w", stdout);
    ll n, s;
    cin >> n >> s;

    FOR(i, n)
    {
        ll a;
        cin >> a >> k[i];
        p[i] = (a + k[i] - 1)/ k[i];
    }
    ll ans = 0;
    FOR(i, n)
        ans += p[i];
    ll t = max(ans - s, 0ll);
    vector<pair<ll, ll> > men;
    FOR(i, n)
        men.pb({k[i], p[i]});
    sort(men.begin(), men.end());
    ans = 0;
    ll q = 0;
    while (t > 0){
        if(t <= men[q].second){
            ans += t * men[q].first;
            t = 0;
        }
        else{
            t -= men[q].second;
            ans += men[q].second * men[q].first;
        }
        q++;
    }
    cout << ans;
    return 0;
}
