#include <bits/stdc++.h>
using namespace std;
int L[5];
long long c;
long long A[100000], B[100000];
int n;
long long days(long long mid) {
  long long act = n;
  for (int i = (0); i < (n); i++) {
    if (A[i]) act += (mid / B[i]);
    if (act > c) return c + 1;
  }
  act = n;
  for (int i = (0); i < (n); i++) {
    act += (mid / B[i]) * A[i];
    if (act > c) return c + 1;
  }
  act = n;
  for (int i = (0); i < (n); i++) {
    act += (mid * A[i]) / B[i];
    if (act > c) return c + 1;
  }
  return act;
}
long long maxC() {
  long long lo = 0, hi = (long long)1e18;
  while (lo < hi) {
    long long mid = (lo + hi + 1) / 2;
    if (days(mid) > c)
      hi = mid - 1;
    else
      lo = mid;
  }
  return hi;
}
long long minC() {
  long long lo = 0, hi = (long long)1e18;
  while (lo < hi) {
    long long mid = (lo + hi) / 2;
    if (days(mid) < c)
      lo = mid + 1;
    else
      hi = mid;
  }
  return lo;
}
int main() {
  cin >> n >> c;
  for (int i = (0); i < (n); i++) cin >> A[i] >> B[i];
  int inf = 1;
  for (int i = (0); i < (n); i++) inf = inf && (A[i] == 0);
  if (inf)
    cout << -1 << endl;
  else {
    long long m = minC();
    long long M = maxC();
    if (m == 0) m++;
    if (days(m) == c && days(M) == c && M >= m)
      cout << M - m + 1;
    else
      cout << 0 << endl;
  }
  return 0;
}
