#include <bits/stdc++.h>
using namespace std;
void w() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
vector<pair<long long int, long long int> > v;
long long int c;
long long int fun(long long int m) {
  long long int t = 0;
  for (auto a : v) {
    if (a.first != 0 && LLONG_MAX / a.first < m) {
      return LLONG_MAX;
    }
    t = t + 1 + (m * a.first) / a.second;
  }
  return t;
}
int32_t main() {
  w();
  long long int n;
  cin >> n >> c;
  long long int tt = 0;
  for (long long int i = 0; i < n; i++) {
    long long int a, b;
    cin >> a >> b;
    v.push_back({a, b});
    tt += a;
  }
  if (tt == 0) {
    if (n == c)
      cout << -1;
    else
      cout << 0;
    return 0;
  }
  long long int m, s = 0, e = LLONG_MAX, second = 1;
  while (s <= e) {
    m = s + (e - s) / 2;
    long long int k = fun(m);
    if (k == c) {
      second = 0;
      break;
    }
    if (k > c) e = m - 1;
    if (k < c) s = m + 1;
  }
  if (second) {
    cout << 0;
    return 0;
  }
  s = 1;
  e = m;
  while (s < e) {
    long long int p = (s + e) / 2;
    if (fun(p) >= c)
      e = p;
    else
      s = p + 1;
  }
  long long int f = s;
  s = m;
  e = LLONG_MAX;
  while (s != e) {
    long long int p = s + (e - s) / 2;
    if (fun(p) > c)
      e = p;
    else
      s = p + 1;
  }
  if (e - f >= LLONG_MAX - 500)
    cout << -1;
  else
    cout << e - f;
}
