#include <bits/stdc++.h>
using namespace std;
int n, c;
int A[10000];
int B[10000];
long long f(long long x) {
  long long res = n;
  for (int i = 0; i < n; ++i) res += A[i] * x / B[i];
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> c;
  if (c < n) return cout << 0 << endl, 0;
  for (int i = 0; i < n; ++i) cin >> A[i] >> B[i];
  long long ma = 1e5;
  while (f(ma) <= c && ma < 2e18) ma *= 2;
  if (ma >= 2e18) {
    if (n == c)
      cout << -1 << endl;
    else
      cout << 0 << endl;
    return 0;
  }
  long long l = 0, r = ma;
  while (l + 1 < r) {
    long long m = (l + r) / 2;
    if (f(m) <= c)
      l = m;
    else
      r = m;
  }
  long long right = r;
  l = 0, r = ma;
  while (l + 1 < r) {
    long long m = (l + r) / 2;
    if (f(m) < c)
      l = m;
    else
      r = m;
  }
  cout << right - r << endl;
  return 0;
}
