#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<iostream>
#include<fstream>
#include<vector>
#include<set>
#include<map>

using namespace std;

typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mk make_pair
#define ppb pop_back
#define forn(i, n) for(int i = 0; i < n; ++i)
#define for1(i, n) for(int i = 1; i <= n; ++i)
#define forq(i, q, n) for(int i = 1; i < n; ++i)
#define all(a) a.begin(), a.end()
#define x first
#define y second

const int mod = 1e9 + 7;
const ll inf = 1e15 + 7;
const double eps = 1e-6;
const int maxn = 1e5 + 7;

map<int, int> m;
vector<pii> a;

bool cmp(pii a, pii b)
{
	return a.y > b.y || a.y == b.y && a.x > b.x;
}

bool cmp1(pii a, pii b)
{
	return a.x > b.x;
}

int main()
{
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
	freopen("castle.in", "r", stdin);
	freopen("castle.out", "w", stdout);
	int n, s;
	cin >> n >> s;
	forn(i, n)
	{
		int x, y;
		scanf("%d%d", &x, &y);
		a.pb(mk(y, x));
	}
	sort(all(a), cmp1);
	forn(i, n)
	{
		int kol1 = a[i].y / a[i].x;
		if (m.find(a[i].x) != m.end())
			m[a[i].x] += kol1;
		else
			m[a[i].x] = kol1;
		if (a[i].y % a[i].x != 0)
		{
			int ost = a[i].y % a[i].x;
			if (m.find(ost) != m.end())
				m[ost] += 1;
			else
				m[ost] = 1;
		}
	}
	/*for (auto it = m.rbegin(); it != m.rend(); ++it)
		cout << it->x << " " << it->y << "\n";*/
	for (auto it = m.rbegin(); it != m.rend(); ++it)
	{
		if (s >= (*it).y)
		{
			s -= (*it).y;
			(*it).y = 0;
		}
		else
		{
			(*it).y -= s;
			s = 0;
			break;
		}
	}
	int ans = 0;
	for (auto it = m.rbegin(); it != m.rend(); ++it)
	{
		ans += it->y * it->x;
	}
	cout << ans;
	return 0;
}