#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define forq(i, q, n) for (int i = int(q); i < int(n); ++i)
#define mk make_pair
#define psh push_back
#define all(v) v.begin(), v.end()
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define Y second
#define X first
#define TASK "castle"

typedef long long ll;
typedef vector <int> vi;
typedef pair <ll, ll> pii;

const int MAXN = (int)1e5 + 7;
const int INF = (int)1e9 + 7;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;

void file()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#else
	freopen(TASK".in", "r", stdin); freopen(TASK".out", "w", stdout);
#endif
}

bool comp(pii a, pii b) {
	return a.Y > b.Y;
}

int main() {
	file();
	ll n, x, y, s;
	scanf("%lld%lld", &n, &s);
	vector <pii> A;
	forn(i, n) {
		scanf("%lld%lld", &x, &y);
		if (x % y == 0) {
			A.psh(mk(x, y));
		}
		else {
			A.psh(mk(y * (x / y), y));
			A.psh(mk(x % y, x % y));
		}
	}
	sort(all(A), comp);
	ll d = 0;
	ll ans = 0;
	forn(i, A.size()) {
		if ((s - d) * A[i].Y >= A[i].X) {
			d += A[i].X / A[i].Y;
		}
		else {
			ans += A[i].X - (s - d) * A[i].Y;
			d = s;
		}
	}
	printf("%lld", ans);
	return 0;
}