#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#define k first
#define a second 
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 x, y;
		cin >> x >> y;
		arr.insert(make_pair(y, x));
	}
	int ans = 0;
	for (auto j : arr) {
		ans += j.a;
	}
	set <pair<int, int> > ost;
	while (s != 0 and (int)arr.size() != 0) {
		// cout << ans << endl;;
		// cout << s << endl;
		pair<int,int> i = *(--arr.end());
		// cout << i.first << " " << i.second << endl;
		int x = i.a / i.k;
		x = min(x, s);
		if (!ost.empty()) {
			pair<int, int> j = *(--ost.end());
			if (j.k > x * i.k) {
				ans -= j.k;
				s -= 1;
				ost.erase(--ost.end());
				// cout << "UNO";
			} else {
				s -= x;
				ans -= x * i.k;
				arr.erase(--arr.end());
				if (x * i.k != i.a) {
					ost.insert(make_pair(i.a - x*i.k, i.k));
				}
				// cout << "DUO";
			}
		} else {
			s -= x;
			ans -= x * i.k;
			arr.erase(--arr.end());
			if (x * i.k != i.a) {
				ost.insert(make_pair(i.a - x*i.k, i.k));
			}
			// cout << "TRES";
		}
	}
	// cout << s << endl;
	if (s != 0) {
		while (s > 0 and !ost.empty()) {
			ans -= (*(--ost.end())).a;
			s-=1;
			ost.erase(--ost.end());
		}
	}
	cout << ans;
	fclose(stdin);
	fclose(stdout);
	return 0;
}