#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e4 + 5;
int n;
long long d;
long long a[N], b[N];
long long cnt(long long x) {
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    long long sus = a[i] * x;
    long long jos = b[i];
    ans += sus / jos + 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> d;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
  }
  long long r1 = 0, pas = (1 << 30);
  long long r2 = 0;
  while (pas) {
    if (cnt(r1 + pas) < d) r1 += pas;
    if (cnt(r2 + pas) <= d) r2 += pas;
    pas /= 2;
  }
  cout << r2 - r1 << "\n";
  return 0;
}
