#include <bits/stdc++.h>
using namespace std;
int A[100005], B[100005], N, C;
long long prod(long long a, long long b) {
  if (!a || !b) return 0;
  if (a > C) return C + 1;
  return (a * b);
}
long long f(long long x) {
  long long ret = N;
  for (int i = 1; i <= N; ++i) {
    long long k1 = x / B[i], r1 = x % B[i];
    long long k2 = A[i] / B[i], r2 = A[i] % B[i];
    ret += prod(k1 * B[i], k2);
    if (ret > C) return C + 1;
    ret += prod(k1, r2);
    if (ret > C) return C + 1;
    ret += r1 * k2;
    if (ret > C) return C + 1;
    ret += (r1 * r2) / B[i];
    if (ret > C) return C + 1;
  }
  return ret;
}
int main() {
  bool allzero = 1;
  scanf("%d%d", &N, &C);
  for (int i = 1; i <= N; ++i) {
    scanf("%d%d", &A[i], &B[i]);
    if (A[i]) allzero = 0;
  }
  if (allzero && N == C)
    printf("-1\n");
  else if (N > C)
    printf("0\n");
  else {
    long long lo = 1, hi = 1000000000000000000LL;
    while (lo < hi) {
      long long x = (lo + hi) / 2;
      if (f(x) < C)
        lo = x + 1;
      else
        hi = x;
    }
    if (f(lo) != C) {
      printf("0\n");
      return 0;
    }
    long long fir = lo;
    lo = 1;
    hi = 1000000000000000000LL;
    while (lo < hi) {
      long long x = (lo + hi + 1) / 2;
      if (f(x) > C)
        hi = x - 1;
      else
        lo = x;
    }
    printf("%I64d\n", lo - fir + 1);
  }
}
