#include <iostream>
#include <fstream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;
int main()
{
	ifstream in;
	ofstream out;
	in.open("castle.in");
	out.open("castle.out");
	int n, i, s, x, y, ans = 0;
	in >> n >> s;
	set<pair<int, int > > a;
	for (i = 0; i < n; i++)
	{
		in >> x >> y;
		a.insert(make_pair(-y, x));
		ans += x;
	}
	while (s > 0 && ans > 0)
	{
		x = a.begin()->second;
		y = -a.begin()->first;
		if (x / y <= s)
		{
			ans -= (x / y) * y;
			s -= (x / y);
			a.erase(make_pair(-y, x));
			a.insert(make_pair(-(x - (x / y) * y), x - (x / y) * y));
		}
		else
		{
			ans -= s * y;
			s = 0;
		}
	}
	out << ans;
	in.close();
	out.close();
}