#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>;
#include <algorithm>;
#include <vector>;
using namespace std;
int n, s;
pair<pair<int, int>, int> arr[100001];
pair<pair<int, int>, int> func(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
	if (a.first.first > b.first.first) {
		return a;
	}
	return b;
}
int main() {
	freopen("castle.in", "r", stdin);
	freopen("castle.out", "w", stdout);
	scanf("%d%d", &n, &s);
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		int a, k;
		scanf("%d%d", &a, &k);
		ans += a;
		arr[i] = make_pair(make_pair(k, (a/k)), i+1);
	}
	sort(arr, arr+n);
	for (int i = n - 1; i >= 0; i--) {
		if (s >= arr[i].first.second) {
			s -= arr[i].first.second;
			ans -= arr[i].first.second * arr[i].first.first;
		}
		else if (s != 0) {
			ans -= arr[i].first.second * s;
			s = 0;
		}
	}
	printf("%lld", ans);
	return 0;
}
