#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <fstream>

using namespace std;

long long n, s, ans;
vector <pair <long long, long long> > v;

bool cmp(pair <long long, long long> a, pair <long long, long long> b) {
	if (a.first == b.first)
		return a.second > b.second;
	else
		return a.first < b.first;
}

int main() {
	//ifstream cin("in.txt");
	//ofstream cout("out.txt");
	ifstream cin("castle.in");
	ofstream cout("castle.out");
	cin >> n >> s;
	for (int i = 1; i <= n; i++) {
		long long a, b;
		cin >> a >> b;
		v.push_back({ b, a });
	}
	sort(v.begin(), v.end(), cmp);
	for (int i = v.size() - 1; i >= 0; i--)
		if ((v[i].second + v[i].first - 1) / v[i].first <= s) {
			s -= (v[i].second + v[i].first - 1) / v[i].first;
		}
		else {
			ans += v[i].second - s * v[i].first;
			s = 0;
		}
		cout << ans;
		return 0;
}