#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i++)
#define sz(a) (int)a.size()
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
using namespace std;
typedef long long ll;

const int MAXN = 100500;
const string NAME = "castle";

pair <ll, ll> arr[MAXN];
ll need[MAXN];
ll cn;

ll n, s;

int main()
{
#ifndef LOCAL                                        
	freopen((NAME + ".in").c_str(), "rt", stdin);
	freopen((NAME + ".out").c_str(), "wt", stdout);
#endif	

	cin >> n >> s;

	forn(i, n)
		cin >> arr[i].second >> arr[i].first;

	sort(arr, arr + n);

	forn(i, n)
	{
		need[i] = arr[i].second / arr[i].first;
		if (arr[i].second % arr[i].first != 0)
			need[i]++;
	}

	forn(i, n)
		cn += need[i];

	ll res = 0;

	forn(i, n)
	{
		if (cn > s)
		{
			ll cnt = min(cn - s, need[i]);

			cn -= cnt;
			need[i] -= cnt;
		}                      
	}

	forn(i, n)
		res += max(0ll, arr[i].second - arr[i].first * need[i]);

	cout << res;

	

	return 0;
}