#include <bits/stdc++.h>
using namespace std;
long long int n, c;
vector<pair<long long int, long long int> > v;
unsigned long long int check(long long int mid) {
  unsigned long long int ans = mid, res = 0;
  for (long long int i = 0; i < n; i++) {
    ans = v[i].first * 1LL * mid;
    if (ans / mid != v[i].first) return 1e10;
    if (res > c) return res;
    res += 1LL + (v[i].first * mid) / v[i].second;
  }
  return (res);
}
void sober() {
  cin >> n >> c;
  long long int a, b, sum = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a >> b;
    v.push_back({a, b});
    sum += a;
  }
  long long int ans = 0;
  long long int lo = 1, hi = 1e18, left, right;
  left = right = 1e18;
  while (lo <= hi) {
    long long int mid = lo + (hi - lo) / 2;
    if (check(mid) >= c) {
      hi = mid - 1;
      left = mid;
    } else {
      lo = mid + 1;
    }
  }
  lo = 1, hi = 1e18;
  while (lo <= hi) {
    long long int mid = lo + (hi - lo) / 2;
    if (check(mid) <= c) {
      lo = mid + 1;
      right = mid;
    } else {
      hi = mid - 1;
    }
  }
  if (!sum and !c || !sum and c == n) {
    cout << "-1\n";
    return;
  }
  if (right - left + 1 == (long long int)(1e18) || check(left) != c ||
      check(right) != c)
    ans = 0;
  else
    ans = right - left + 1;
  cout << max(ans, 0LL) << '\n';
  return;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) {
    sober();
  }
}
