#include <iostream>
#include <cstdio>

using namespace std;

const int maxn = 2e5;

int a[maxn];
int k[maxn];
int r[maxn];
int n, s, u;

int main()
{
    freopen("castle.in", "r", stdoin);
    freopen("castle.out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n >> s;
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> k[i];
        u += (r[i] = (a[i]-1)/k[i]+1);
    }
    if (u <= s) {
        cout << "0\n";
        return 0;
    }
    u -= s;
    cout << u << '\n';
    return 0;
}
