#include <bits/stdc++.h>
using namespace std;
const long long maxN = 1e5 + 12;
const long long INF = 1e18 + 12;
const long long Inf = 1e9 + 12;
long long n, c, a[maxN], b[maxN], sum;
long long check(long long x) {
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] > INF / x) return INF;
    ans += (1 + a[i] * x / b[i]);
  }
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> c;
  for (long long i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    sum += a[i];
  }
  if (!sum && c == n) {
    cout << -1 << endl;
    return 0;
  }
  long long l = 0, r = INF;
  while (l < r) {
    long long mid = (r + l) / 2;
    if (l == mid) mid++;
    long long x = check(mid);
    if (x < c)
      l = mid;
    else
      r = mid - 1;
  }
  long long L = l, R;
  l = 0, r = INF;
  while (l < r) {
    long long mid = (r + l) / 2;
    if (l == mid) mid++;
    long long x = check(mid);
    if (x <= c)
      l = mid;
    else
      r = mid - 1;
  }
  R = r;
  cout << R - L << endl;
}
