#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    freopen("castle.in", "r", stdin);
    freopen("castle.out", "w", stdout);
    int n, s;
    cin >> n >> s;
    set<pair<int, int> > arr;
    for (int i = 0; i < n; i++)
    {
        int a, k;
        cin >> a >> k;
        arr.insert(make_pair(k, a));
    }
    set<pair<int, int> > :: iterator it;
    it = arr.end();
    it--;
    while (s > 0 && arr.size() != 0)
    {
        it = arr.end();
        it--;
        if ((*it).second / (*it).first <= s)
        {
            s -= (*it).second / (*it).first;
            pair<int, int> q;
            q.second = (*it).second % (*it).first;
            q.first = q.second;
            arr.erase(*it);
            if (q.second != 0)
            {
                arr.insert(q);
            }
        }
        else
        {
            pair<int, int> q;
            q.second = (*it).second;
            q.first = (*it).first;
            q.second -= q.first * s;
            arr.erase(*it);
            arr.insert(q);
            s = 0;
        }
    }
    int res = 0;
    for (set<pair<int, int> > :: iterator it1 = arr.begin(); it1 != arr.end(); it1++)
    {
        res += (*it1).second;
    }
    cout << res << endl;
    return 0;
}
