#include <bits/stdc++.h>
using namespace std;
int n;
long long m, lo, hi, a[100005], b[100005], A;
long long doit(long long x) {
  long long r = 0;
  for (int i = (0); i < (n); i++) {
    if (!a[i]) {
      r++;
      continue;
    }
    if (x > m * b[i] / a[i] + b[i]) return m + 1;
    r += 1 + x * a[i] / b[i];
    if (r > m) return m + 1;
  }
  return r;
}
int main() {
  scanf("%d%I64d", &n, &m);
  for (int i = (0); i < (n); i++) scanf("%I64d%I64d", &a[i], &b[i]), A += a[i];
  if (!A) {
    if (n == m)
      puts("-1");
    else
      puts("0");
    return 0;
  }
  for (long long i = 1, j = (long long)(1e18 + 100), k; j >= i;) {
    k = i + (j - i) / 2;
    if (doit(k) >= m)
      lo = k, j = k - 1;
    else
      i = k + 1;
  }
  for (long long i = 1, j = (long long)(1e18 + 100), k; j >= i;) {
    k = i + (j - i) / 2;
    if (doit(k) <= m)
      hi = k, i = k + 1;
    else
      j = k - 1;
  }
  printf("%I64d\n", max(0LL, hi - lo + 1));
  return 0;
}
