#include <bits/stdc++.h>
using namespace std;
int a[10010], b[10010];
int n, c;
long long calc_time(long long x) {
  long long s = n;
  for (int i = 1; i <= n; i++) {
    if (a[i] > 0 && x > (long long)(c - s + 1) * b[i] / a[i]) return c + 1;
    s += a[i] * x / b[i];
  }
  return s;
}
void init() {
  cin >> n >> c;
  for (int i = 1; i <= n; i++) cin >> a[i] >> b[i];
}
void solve() {
  long long ans;
  bool flag = true;
  for (int i = 1; i <= n; i++)
    if (a[i] != 0) flag = false;
  if (flag && c == n) {
    cout << "-1" << endl;
    return;
  }
  long long l = 1, r = 1000000000;
  r *= r;
  while (r >= l) {
    long long mid = (l + r) / 2;
    if (calc_time(mid) <= c)
      l = mid + 1;
    else
      r = mid - 1;
  }
  ans = r;
  l = 1, r = 1000000000;
  r *= r;
  while (r >= l) {
    long long mid = (l + r) / 2;
    if (calc_time(mid) >= c)
      r = mid - 1;
    else
      l = mid + 1;
  }
  ans = ans - l + 1;
  if (calc_time(l) != c) ans = 0;
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  init();
  solve();
  return 0;
}
