#include <bits/stdc++.h>
using namespace std;
long long n, c, a[10010], b[10010], L, H;
int main() {
  cin >> n >> c;
  c -= n;
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  long long lo = 0, hi = 1000000007LL * 1000000007LL;
  while (lo + 1 < hi) {
    long long mi = (lo + hi) / 2;
    long long sum = 0, over = 0;
    for (int i = 0; i < n; i++) {
      if (sum > c) break;
      if (a[i] == 0) continue;
      if (mi > 1000000007LL * 1000000007LL / a[i]) {
        over = 1;
        break;
      }
      sum += a[i] * mi / b[i];
    }
    if (over || sum >= c)
      hi = mi;
    else
      lo = mi;
  }
  L = hi;
  lo = 0, hi = 1000000007LL * 1000000007LL;
  while (lo + 1 < hi) {
    long long mi = (lo + hi) / 2;
    long long sum = 0, over = 0;
    for (int i = 0; i < n; i++) {
      if (sum > c) break;
      if (a[i] == 0) continue;
      if (mi > 1000000007LL * 1000000007LL / a[i]) {
        over = 1;
        break;
      }
      sum += a[i] * mi / b[i];
    }
    if (over || sum > c)
      hi = mi;
    else
      lo = mi;
  }
  H = hi;
  if (L == 1 && H == 1000000007LL * 1000000007LL)
    cout << -1;
  else
    cout << H - L;
}
