#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

const int mn = 100010;
typedef pair <long long, long long> pll;
vector <pll> v;
long long n, s, ans;

int main() {
	freopen("castle.in", "r", stdin);
	freopen("castle.out", "w", stdout);
	cin >> n >> s;
	for (int i = 0; i < n; i++) {
		long long x, y;
		cin >> x >> y;
		v.push_back(make_pair(-y, x / y));
		if (x % y != 0) {
			v.push_back(make_pair(-(x % y), 1));
		}
	}
	sort(v.begin(), v.end());
	ans = 0;
	for (int i = 0; i < v.size(); i++) {
		if (s == 0) {
			ans += (-v[i].first) * v[i].second;
		} else {
			if (s >= v[i].second) {
				s -= v[i].second;
			} else {
				ans += (-v[i].first) * (v[i].second - s);
				s = 0;
			}
		}
	}
	cout << ans;
	return 0;
}