#include <bits/stdc++.h>
using namespace std;
unsigned long long n, t, a[10005], b[10005], l, r, ll, rr, ans, mid;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> t;
  t -= n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  l = 1;
  r = 1e18;
  while (l <= r) {
    mid = (l + r) / 2;
    ans = 0;
    for (int i = 0; i < n; i++) {
      ans += mid * a[i] / b[i];
    }
    if (ans >= t) {
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  ll = 1;
  rr = 1e18;
  while (ll <= rr) {
    ans = 0;
    mid = (ll + rr) / 2;
    for (int i = 0; i < n; i++) {
      ans += mid * a[i] / b[i];
    }
    if (ans <= t) {
      ll = mid + 1;
    } else {
      rr = mid - 1;
    }
  }
  if (ll - l == 1e18) {
    cout << -1 << '\n';
  } else {
    cout << ll - l << '\n';
  }
}
