#include <bits/stdc++.h>
using namespace std;
const int MAXN = 20000;
int n, c;
int a[MAXN], b[MAXN];
inline long long check(long long x) {
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    if (1. * x * a[i] > 1LL * b[i] * c + 1LL * b[i] * 100) return c + 1000LL;
    sum += 1 + (x * a[i]) / b[i];
  }
  return sum;
}
int main() {
  scanf("%d%d", &n, &c);
  bool iscorner = 1;
  for (int i = 0; i < n; i++) scanf("%d%d", a + i, b + i), iscorner &= !a[i];
  if (iscorner) {
    if (c == n)
      puts("-1");
    else
      puts("0");
    return 0;
  }
  long long l, r;
  long long lo, hi, mi;
  for (lo = 1, hi = 2000000000000000000LL; lo < hi;) {
    mi = (hi + lo + 1) / 2;
    if (check(mi) > c)
      hi = mi - 1;
    else
      lo = mi;
  }
  r = lo;
  if (check(lo) != c) {
    puts("0");
    return 0;
  }
  for (lo = 1, hi = 2000000000000000000LL; lo < hi;) {
    mi = (hi + lo) / 2;
    if (check(mi) < c)
      lo = mi + 1;
    else
      hi = mi;
  }
  l = lo;
  cout << max(0LL, r - l + 1) << endl;
  return 0;
}
