#include <bits/stdc++.h>
using namespace std;
long long int powmod(long long int a, int b, int n) {
  long long int rm = 1;
  while (b) {
    if (b % 2) {
      rm = (rm * a) % n;
    }
    a = (a * a) % n;
    b /= 2;
  }
  return rm;
}
long long int n, a[10010], b[10010], c, it, f, m, id1, id2;
int check(long long int x) {
  long long int days = 0;
  for (int i = (int)1; i <= (int)n; i++) {
    if (a[i]) {
      if (x > (c * b[i]) / a[i] || days > c) return 1;
    }
    days += 1 + (a[i] * x) / b[i];
  }
  if (days > c) return 1;
  if (days == c) return 0;
  return -1;
}
int main() {
  cin >> n >> c;
  for (int i = (int)1; i <= (int)n; i++) {
    cin >> a[i] >> b[i];
  }
  it = 1;
  f = 1000000001000000000LL;
  while (it != f) {
    m = (it + f) / 2;
    if (check(m) >= 0)
      f = m;
    else
      it = ++m;
  }
  if (check(f) != 0) {
    cout << 0 << endl;
    return 0;
  }
  id1 = f;
  it = 1;
  f = 1000000001000000000LL;
  while (it != f) {
    m = (it + f) / 2 + 1;
    if (check(m) <= 0)
      it = m;
    else
      f = m - 1;
  }
  id2 = f;
  if (id2 - id1 + 1 == 1000000001000000000LL)
    cout << -1 << endl;
  else
    cout << id2 - id1 + 1 << endl;
  return 0;
}
