#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cstdio>
#include <vector>
#include <functional>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>

using namespace std;

typedef pair<int, int> ipair;
typedef long long ll;

#define ALL(x) begin(x), end(x)

int du(int a, int b) {
	return a / b + !!(a % b);
}

int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
#else
	freopen("castle.in", "r", stdin);
	freopen("castle.out", "w", stdout);
#endif
	cin.sync_with_stdio(0);
	cin.tie(0);

	int n, s;
	cin >> n >> s;
	vector<ipair> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i].first >> a[i].second;
	}
	sort(ALL(a), [](const ipair &a, const ipair &b) {
		if ((ll)a.first * b.second == (ll)b.first * a.second) {
			return a.first > b.first;
		}
		return (ll)a.first * b.second > (ll)b.first * a.second;
	});

	ll ans = 0;

	for (int i = 0; i < n; ++i) {
		int can = min(s, du(a[i].first, a[i].second));
		/*while (s > 0 && a[i].first > 0) {
		a[i].first -= a[i].second;
		--s;
		}*/
		s -= can;
		ans += max(0LL, (ll)a[i].first - (ll)a[i].second * can);
	}

	cout << ans << "\n";
}

//#define _CRT_SECURE_NO_WARNINGS
//
//#include <iostream>
//#include <cstdio>
//#include <vector>
//#include <functional>
//#include <set>
//#include <map>
//#include <cmath>
//#include <algorithm>
//#include <numeric>
//
//using namespace std;
//
//typedef pair<int, int> ipair;
//typedef long long ll;
//
//#define ALL(x) begin(x), end(x)
//
//int du(int a, int b) {
//	return a / b + !!(a % b);
//}
//
//int main() {
//#ifdef _DEBUG
//	freopen("in.txt", "r", stdin);
//#else
//	freopen("castle.in", "r", stdin);
//	freopen("castle.out", "w", stdout);
//#endif
//	cin.sync_with_stdio(0);
//	cin.tie(0);
//
//	int n, s;
//	cin >> n >> s;
//	vector<int> a(n), d(n);
//	for (int i = 0; i < n; ++i) {
//		cin >> a[i] >> d[i];
//	}
//
//	vector<vector<ll>> dp(n + 1, vector<ll>(s + 1));
//	dp[0][s] = 0;
//	for (int i = 0; i < n; ++i) {
//		for (int j = 0; j <= s; ++j) {
//			for (int l = 0; l < j; ++l) {
//				dp[i + 1][j - l] = max(dp[i + 1][j - l], dp[i][j] + min(a[i], d[i] * 
//			}
//		}
//	}
//}
