#include <bits/stdc++.h>

using namespace std;

struct edge{
    int a, k, num;
};

int main()
{
    freopen("castle.in", "r", stdin);
    freopen("castle.out", "w", stdout);
    int n, s;
    cin >> n >> s;
    vector <edge> m(n);
    set < pair<int, int> > q;
    for (int i = 0; i < n; ++i)
    {
        cin >> m[i].a >> m[i].k;

        q.insert(make_pair(-m[i].k, -m[i].a));
    }
    long long ans = 0;
    int cost, need, can;
    while (q.size() != 0)
    {
        cost = -q.begin()->first;
        need = -q.begin()->second;
        if (cost != 0)
        {
            can = min(s, need / cost);
            //cout << cost << ' ' << need << ' ' << can << endl;
        }
        else
            can = 0;
        if (can == 0)
        {
            ans += need;
            q.erase(q.begin());
        }
        else
        {
            q.erase(q.begin());
            need -= (cost * can);
            s -= can;
            if (cost > need)
                cost = need;
            q.insert(make_pair(-need, -need));
        }

    }
    cout << ans;


}
