#define _CRT_SECURE_NO_DEPRECATE
#pragma comment(linker, "/STACK:512000000")
#include <iostream>
#include <algorithm>
#include <queue>


typedef long long ll;


using namespace std;


struct wall {
	ll a, k;
} a[100005];


bool operator < (wall A, wall B) {
	return A.k < B.k;
}


#define TASK "castle"


int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	freopen(TASK".in", "r", stdin);
	freopen(TASK".out", "w", stdout);
#endif // _DEBUG

	ll n, s;
	cin >> n >> s;
	ll ans = 0;
	priority_queue<wall> que;
	for (int i = 0; i < n; i++) {
		cin >> a[i].a >> a[i].k;
		ans += a[i].a;
		que.push(a[i]);
	}
	while (s > 0 && !que.empty()) {
		wall twall = que.top();
		que.pop();
		ll soild = min(s, twall.a / twall.k);
		ans -= soild * twall.k;
		twall.a -= soild * twall.k;
		twall.k = twall.a;
		s -= soild;
		if (twall.k > 0) {
			que.push(twall);
		}
	}
	cout << ans;
}