#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<math.h>
#include<iostream>
#include<queue>

#pragma warning (disable:4996)

#define ll long long int
#define mp make_pair

using namespace std;

ll n, s;
map<ll, ll> m;
map<ll, ll>::iterator it;

void solve() {
	ll i, j,a,k,sum=0;
	for (i = 0; i < n; i++) {
		scanf("%I64d%I64d", &a, &k);
		m[k] = a;
		sum += a;
	}
	while (s > 0 && m.size() > 0) {
		it = m.end();
		it = prev(it);
		a = it->second;
		k = it->first;
		if (s <= a / k) {
			sum -= s*k;
			s = 0;
		}
		else {
			sum -= a / k*k;
			s -= a / k;
			a %= k;
			m.erase(it);
			if (a > 0) {
				m[a] += a;
			}
		}
	}
	printf("%I64d", sum);
	return;
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#else
	freopen("castle.in", "rt", stdin);
	freopen("castle.out", "wt", stdout);
#endif
	scanf("%I64d%I64d", &n, &s);
	solve();
	return 0;
}
