#include <bits/stdc++.h>
using namespace std;
long long int a[10004];
long long int b[10004];
long long int mx = 0;
int check(long long int x, long long int n, long long int c) {
  long long int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += (1 + (a[i] * x / b[i]));
    if (sum > c) return 2;
  }
  if (sum == c) return 1;
  if (sum > c) return 2;
  return 0;
}
long long int binr(long long int c, long long int n) {
  long long int l = 1;
  long long int r = 1e9;
  while (l <= r) {
    long long int m = l + (r - l) / 2;
    if (check(m, n, c) == 2)
      r = m - 1;
    else
      l = m + 1;
  }
  return l;
}
long long int binl(long long int c, long long int n) {
  long long int l = 1;
  long long int r = 1e9;
  while (l <= r) {
    long long int m = l + (r - l) / 2;
    if (check(m, n, c) >= 1)
      r = m - 1;
    else
      l = m + 1;
  }
  return r + 1;
}
int main() {
  long long int n, c;
  cin >> n >> c;
  for (int i = 0; i < n; i++) {
    scanf("%I64d%I64d", a + i, b + i);
    mx = max(mx, a[i]);
  }
  if (mx == 0) {
    if (n == c)
      cout << "-1";
    else
      cout << "0";
    return 0;
  }
  cout << binr(c, n) - binl(c, n);
}
