#include <bits/stdc++.h>
using namespace std;
template <class t, class u>
void chmax(t& first, u second) {
  if (first < second) first = second;
}
template <class t, class u>
void chmin(t& first, u second) {
  if (second < first) first = second;
}
vector<unsigned long long int> ai, bi;
int n;
unsigned long long int c;
unsigned long long int f(unsigned long long int x, bool DEBUG = 0) {
  unsigned long long int num = 0LL;
  for (int rep = 0; rep < n; ++rep) {
    long double x1 = ai[rep], y1 = bi[rep];
    num += 1LL + (long long)((x1 / y1) * x);
  }
  return num;
}
long long int binary_search_upper() {
  unsigned long long int lo = 0, hi = 1e18;
  while (hi - lo > 1) {
    unsigned long long int mi = lo + (hi - lo) / 2;
    if (f(mi) <= c)
      lo = mi;
    else
      hi = mi;
  }
  return hi;
}
long long int binary_search_lower() {
  long long int lo = 0, hi = 1e18;
  while (hi - lo > 1) {
    unsigned long long int mi = lo + (hi - lo) / 2;
    if (f(mi) < c)
      lo = mi;
    else
      hi = mi;
  }
  return hi;
}
int main() {
  scanf("%d", &n);
  scanf("%llu", &c);
  for (int rep = 0; rep < n; rep++) {
    unsigned long long int x, y;
    scanf("%llu%llu", &x, &y);
    ai.push_back(x);
    bi.push_back(y);
  }
  bool ok = false;
  for (int rep = 0; rep < n; rep++)
    if (ai[rep] != 0) ok = 1;
  if (!ok && (unsigned long long int)n == c)
    return !printf("-1\n");
  else if (!ok)
    return !printf("0\n");
  else {
    long long int p1 = binary_search_upper(), p2 = binary_search_lower();
    long long int res = p1 - p2;
    printf("%lld\n", res);
  }
  return 0;
}
