#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>

#define rep(i, n) for (decltype(n) i = 0; i < n; i++)
#define dep(i, n) for (decltype(n) i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (decltype(b) i = a; i <= b; i++)
#define FORD(i, a, b) for (decltype(a) i = a; i >= b; i--)
#define len(a) (int)a.size()
#define all(a) a.begin(), a.end()
typedef long long int64;
using namespace std;

const int maxn = 1e5 + 10;
int64 a[maxn], k[maxn];
pair<pair<int64, int64>, int> x[maxn];
int main()
{
	freopen("castle.in", "r", stdin);
	freopen("castle.out", "w", stdout);
	int64 n, s;
	cin >> n >> s;
	rep(i, n)
	{
		cin >> a[i] >> k[i];
		x[i] = { {k[i], a[i]}, (int)i };
	}
	sort(x, x + n);
	int64 ans = 0;
	dep(i, n)
	{
		int64 curx = x[i].first.second / x[i].first.first;
		if (s >= curx)
			s -= curx, a[x[i].second] -= curx * x[i].first.first;
		else
		{
			curx = s;
			s = 0;
			a[x[i].second] -= curx * x[i].first.first;
		}
	}
	//rem
	rep(i, n)
		ans += a[i];
	//rem
	cout << ans << endl;
	return 0;
}