#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

#ifdef _DEBUG
#include <fstream>
ifstream cin("input.txt");
ofstream cout("output.txt");
#else
#include <fstream>
ifstream cin("castle.in");
ofstream cout("castle.out");
#endif

long long x, s;

map < long long, long long > ans;

int main() {
	cin >> x >> s;
	for (long long i = 0; i < x; i++) {
		long long l, r;
		cin >> l >> r;
		ans[r] += l / r;
		ans[l % r] += 1;
	}
	long long f = 0;
	for (auto i = ans.rbegin(); i != ans.rend(); i++) {
		if (s > 0) {
			if (s >= i->second) {
				s -= i->second;
			}
			else {
				i->second -= s;
				s = 0;
				f += i->second * i ->first;
			}
		}
		else {
			f += i->second * i->first;
		}
	}
	cout << f;
}