#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
#define S second
#define F first
using namespace std;

ll k[MAXN + 1];
ll a[MAXN + 1];
ll m[MAXN + 1];
#define FILENAME "castle"
int main()
{
    freopen(FILENAME".in", "r", stdin);
    freopen(FILENAME".out", "w", stdout);
    ll n, s;
    cin >> n >> s;
    vector<pair<ll, ll> > p(2 * MAXN + 1);
    FOR(i, n)
    {
        cin >> a[i] >> k[i];
        p[i] = {-k[i], a[i]};
    }
    ll ans = 0;
    FOR(i, n)
    {
        p[n + i] = {-(p[i].S % (-p[i].F)), 1};
        p[i].S = p[i].S / (-p[i].F);
    }
    sort(p.begin(), p.end());
    ll q = 0;
    while (s > 0 && q < 2 * n)
    {
        p[q].F *= -1;
        ans += min(p[q].S, s) * p[q].F;
        s = max(s - p[q].S, 0ll);
        q++;
    }
    //cout << 1;
    FOR(i, n)
        ans -= a[i];
    cout << -ans;
    return 0;
}
