#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <utility>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#define forn(i, n) for (int i = 0; i < (n); i++)
#define fornn(i, q, n) for (int i = (q); i < (n); i++)

using namespace std;

typedef long long ll;

int solve();
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
#else
	freopen("castle.in", "r", stdin), freopen("castle.out", "w", stdout);
#endif
	solve();
	return 0;
}

vector<pair<int, int> > G;

int solve() {
	int n, s;
	scanf("%d %d", &n, &s);
	G.resize(n);
	forn(i, n) {
		scanf("%d %d", &G[i].first, &G[i].second);
	}
	sort(G.begin(), G.end());
	reverse(G.begin(), G.end());
	ll ans = 0;
	forn(i, n) {
		ll need = G[i].first / G[i].second;
		if (need <= s) {
			ans += G[i].first % G[i].second;
			s -= need;
		}
		else {
			ans += G[i].first - s * G[i].second;
			break;
		}
	}
	printf("%lld", ans);
	return 0;
}