#include <bits/stdc++.h>
using namespace std;
unsigned long long n, t, l, r, c, x, pokir, pokan, a[20000], b[20000];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> t;
  t -= n;
  for (unsigned long long i = 1; i <= n; i++) cin >> a[i] >> b[i];
  l = 1;
  r = 1e18;
  while (l <= r) {
    c = 0;
    x = (l + r) / 2;
    for (unsigned long long i = 1; i <= n; i++) {
      c += a[i] * x / b[i];
    }
    if (c >= t) {
      r = x - 1;
    } else {
      l = x + 1;
    }
  }
  pokir = l;
  l = 1;
  r = 1e18;
  while (l <= r) {
    c = 0;
    x = (l + r) / 2;
    for (unsigned long long i = 1; i <= n; i++) {
      c += a[i] * x / b[i];
    }
    if (c > t) {
      r = x - 1;
    } else {
      l = x + 1;
    }
  }
  pokan = l;
  if (pokir == 1 && pokan == 1e18) {
    cout << -1;
  } else {
    cout << pokan - pokir;
  }
}
