#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

bool cmp(pair<int, int> a, pair<int, int> b) {
	return (ll)a.first * b.second > (ll)a.second * b.first;
}

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	freopen("castle.in", "r", stdin);
	freopen("castle.out", "w", stdout);
	int n, s;
	cin >> n >> s;
	vector<pair<int, int>> a;
	for (int i = 0; i < n; i++) {
		pair<int, int> p;
		cin >> p.first >> p.second;
		if (p.first >= p.second)
			a.push_back(make_pair(p.first / p.second * p.second, p.first / p.second));
		if (p.first % p.second != 0)
			a.push_back(make_pair(p.first % p.second, 1));
	}
	sort(a.begin(), a.end(), cmp);
	int p = 0, ans = 0;
	while (p < a.size() && s)
		if (s >= a[p].second) s -= a[p].second, p++;
		else ans = (a[p].second - s) * (a[p].first / a[p].second), s = 0, p++;
	for (; p < a.size(); p++)
		ans += a[p].first;
	cout << ans;
	return 0;
}