#include <iostream>
#include <algorithm>
#include <set>

using namespace std;

long long a[100013];
long long k[100013];
set <pair <pair <long long, long long>, long long> > ka;
int main() {
	freopen("castle.in", "r", stdin);
	freopen("castle.out", "w", stdout);
	//freopen("1.txt", "r", stdin);
	long long n, s;
	long long gov = 0;

	cin >> n >> s;

	for (long long i = 0; i < n; i++) {
		cin >> a[i] >> k[i];
		ka.insert(make_pair(make_pair(-k[i], a[i]), gov));
		gov++;
	}

	while (!ka.empty() && s > 0) {
		pair <long long, long long> fr = (*ka.begin()).first;
		ka.erase(ka.begin());
		fr.first *= -1;
		long long pos = fr.second / fr.first;
		pos = min(pos, s);
		s -= pos;
		fr.second -= pos * fr.first;
		if (fr.second != 0) {
			ka.insert(make_pair(make_pair(-fr.second, fr.second), gov));
			gov++;
		}
	}

	long long out = 0;

	for (set <pair <pair <long long, long long>, long long> >::iterator i = ka.begin(); i != ka.end(); i++) {
		out += (*i).first.second;
	}
	cout << out;
	return 0;
}