#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<int64, int64> 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] };
	}
	sort(x, x + n);
	int64 ans = 0;
	dep(i, n)
	{
		int64 curx = (x[i].second + x[i].first - 1) / x[i].first;
		if (s >= curx)
			s -=curx;
		else
		{
			curx = s;
			s = 0;
			ans += x[i].second - x[i].first * curx;
		}
	}
	cout << ans << endl;
	return 0;
}