#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) {
		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(0, a[i].first - a[i].second * can);
	}

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