#include <bits/stdc++.h>
using namespace std;
const int inf = 1000000000;
const int MOD = 1000000007;
unsigned long long a[10005], b[10007];
unsigned long long n, c;
unsigned long long ok(unsigned long long x) {
  unsigned long long cnt = n;
  for (int i = 1; i <= n; ++i) {
    if (a[i] && x / b[i] + cnt > c) return c + 1;
    if (x * a[i] / b[i] + cnt > c) return c + 1;
    unsigned long long cur = (a[i] * x) / b[i];
    cnt += cur;
    if (cnt > c) break;
  }
  return cnt;
}
int main() {
  cin >> n >> c;
  unsigned long long ss = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i] >> b[i];
    ss += a[i];
  }
  if (ss == 0 && c == n) {
    cout << "-1" << endl;
    return 0;
  }
  unsigned long long l = 1, r = inf * (unsigned long long)inf * 2LL;
  while (l < r) {
    unsigned long long mid = (l + r) / 2;
    if (ok(mid) < c)
      l = mid + 1;
    else
      r = mid;
  }
  unsigned long long mn = r;
  l = 1, r = inf * (unsigned long long)inf * 2LL;
  while (l < r) {
    unsigned long long mid = 1 + (l + r) / 2;
    if (ok(mid) > c)
      r = mid - 1;
    else
      l = mid;
  }
  unsigned long long mx = r;
  if (ok(mn) != c)
    cout << "0" << endl;
  else
    cout << mx - mn + 1 << endl;
}
