#include <bits/stdc++.h>

#define int ll
#define ll long long

using namespace std;

#undef int
int main() {
	#define int ll
	freopen("castle.in", "r", stdin);
	freopen("castle.out", "w", stdout);
	int n, s;
	cin >> n >> s;
	multiset<pair<int, int>, greater<pair<int, int> > > q;
	for (int i = 0, a, k; i < n; ++i) {
		cin >> a >> k;
		q.insert({k, a});
	}
	while (s > 0 && q.size() > 0) {
		pair<int, int> cur = *q.begin();
		int x = cur.second / cur.first;
		x = min(x, s);
		s -= x;
		q.erase(q.begin());
		if (cur.second - x * cur.first > 0)
            q.insert({cur.second - x * cur.first, cur.second - x * cur.first});
	}

	int ans = 0;
	for (auto it = q.begin(); it != q.end(); ++it) {
        ans += it->second;
	}
	cout << ans << endl;

    return 0;
}
