#include <iostream>
#include <set>
#include <cstdio>
using namespace std;

int main() { // long long,  scanf, linux
	freopen("castle.in", "r", stdin);
	freopen("castle.out", "w", stdout);
	int n, s;
	cin >> n >> s;
	set< pair<int, int> > sol; //коэффицент и ...
	for (int i = 0; i < n; i++) {
		int a, k;
		cin >> a >> k;
		if (k > a) {
			k = a;
		}
		sol.insert({ k, a });
	}
	while ((!sol.empty()) && (s > 0)) {
		pair<int, int> p = *(--sol.end());
		sol.erase(p);
		int m = p.second / p.first;
		int ost = p.second % p.first;
		if (s >= m) {
			s -= m;
			if (ost > 0) {
				sol.insert({ ost, ost });
			}
		} else {
			ost = p.second - p.first * s;
			s = 0;
			sol.insert({ p.first, ost });
		}
	}
	int sum = 0;
	for (auto e : sol) {
		sum += e.second;
	}
	cout << sum;
	return 0;
}