#include <iostream>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <functional>
#include <map>
#include <queue>

#define ll long long
#define ld long double
#define mp make_pair
#define TASKNAME "castle"

using namespace std;

const ll inf = 1e9;

void solve() {
	ll n, s;
	cin >> n >> s;
	vector<pair<ll, ll>> a(n);
	for (ll i = 0; i < n; i++)
		cin >> a[i].second >> a[i].first;
	sort(a.begin(), a.end(), greater<pair<ll, ll>>());
	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		ll cur = ceil((ld)a[i].second / (ld)a[i].first);
		if (cur < s)
			s -= cur;
		else {
			cur = s;
			s = 0;
			ans += (a[i].second - cur * a[i].first);
		}
	}
	cout << ans;
}

int main() {
#ifdef __DEBUG__
	freopen("input.txt", "r", stdin);
	clock_t start = clock();
#else
	freopen(TASKNAME".in", "r", stdin);
	freopen(TASKNAME".out", "w", stdout);
#endif 

	solve();

#ifdef __DEBUG__
	cerr << "\nTime: " << (ld)(clock() - start) / (ld)CLOCKS_PER_SEC << endl;
#endif
}