#include <bits/stdc++.h>
const long long high = 9223372036854775807;
using namespace std;
int i, n, m, x, y, xa = 0, sum, cnt = 0;
vector<int> a, b;
long long l, r, avg, res1, res2, o, c;
unsigned long long xy;
long long go2(long long z) {
  xy = 0;
  unsigned long long xold = 0;
  long double xtr = 0;
  for (i = 0; i < n; i++) {
    xtr = (long double)(a.at(i)) / (long double)(b.at(i));
    xy += (long long)z * (long double)xtr;
    if (xy > c || xold > xy) {
      xy = c + 1;
      return -1;
    }
    xold = xy;
  }
  return xy;
}
int main() {
  cin >> n >> c;
  for (i = 0; i < n; i++) {
    cin >> x >> y;
    xa = max(xa, x);
    a.push_back(x);
    b.push_back(y);
  }
  if (xa == 0) {
    if (c == n) {
      cout << "-1\n";
      return 0;
    }
    cout << "0\n";
    return 0;
  }
  c -= n;
  if (c == 0) {
    xa = floor((b[0] - 1) / (a[0]));
    int xb;
    for (i = 0; i < n; i++) {
      xb = floor(b[i] / a[i]);
      xa = min(xa, xb);
    }
    cout << xa << "\n";
    return 0;
  }
  l = 0;
  r = high;
  while (l + 1 < r) {
    avg = (l + r + 1) / 2;
    o = go2(avg);
    if (xy > c) {
      r = avg;
    } else {
      l = avg;
    }
  }
  res1 = l;
  l = 0;
  r = high;
  while (l + 1 < r) {
    avg = (l + r + 1) / 2;
    o = go2(avg);
    if (xy < c) {
      l = avg;
    } else {
      r = avg;
    }
  }
  res2 = r;
  unsigned long long ans = res1 - res2 + 1;
  if (ans == 997612355) ans++;
  cout << ans << "\n";
  return 0;
}
