#include <bits/stdc++.h>
using namespace std;
const int N = 10004;
long long a[N], b[N], c, sa = 0, mb = 0, M;
int n;
bool ok1(long long x) {
  long long s = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] > 0 && x / b[i] > c / a[i]) return 0;
    s += a[i] * x / b[i] + 1;
    if (s >= c) return 0;
  }
  return 1;
}
bool ok2(long long x) {
  long long s = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] > 0 && x / b[i] > c / a[i]) return 1;
    s += a[i] * x / b[i] + 1;
    if (s > c) return 1;
  }
  return 0;
}
int main() {
  scanf("%d %lld", &n, &c);
  for (int i = 1; i <= n; i++) {
    scanf("%lld %lld", &a[i], &b[i]);
    sa += a[i];
    mb = max(mb, b[i]);
  }
  long long u, v;
  M = c * mb;
  if (sa == 0) return puts(n == c ? "-1" : "0"), 0;
  long long l = 0, r = M;
  while (l < r) {
    long long mid = (l + r + 1) / 2;
    if (ok1(mid))
      l = mid;
    else
      r = mid - 1;
  }
  u = l;
  l = 0, r = M;
  while (l < r) {
    long long mid = (l + r) / 2;
    if (ok2(mid))
      r = mid;
    else
      l = mid + 1;
  }
  v = r;
  printf("%lld\n", max(v - u - 1, 0ll));
}
