#include <bits/stdc++.h>
using namespace std;
long long BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return R;
}
long long n, c;
vector<pair<long long, long long> > v;
long long valid(long long x) {
  long long days = 0;
  for (int i = 0; i < v.size(); i++) {
    days++;
    if (1e18 / x < v[i].first) return 1e18;
    days += (x * v[i].first) / v[i].second;
  }
  return days;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cin >> n >> c;
  long long ini = 0;
  for (int i = 1; i <= n; i++) {
    int a, b;
    cin >> a >> b;
    v.push_back(make_pair(a, b));
    if (a != 0) ini = 1;
  }
  long long lo = 1, hi = 1e18, mid, ans1 = -1;
  if (ini == 0 and n == c) {
    cout << -1;
    return 0;
  }
  while (lo <= hi) {
    mid = (lo + hi) >> 1;
    long long days = valid(mid);
    if (days <= c) {
      ans1 = mid;
      lo = mid + 1;
    } else {
      hi = mid - 1;
    }
  }
  lo = 1, hi = 1e18;
  long long ans2 = -1;
  while (lo <= hi) {
    mid = (lo + hi) >> 1;
    long long days = valid(mid);
    if (days >= c) {
      ans2 = mid;
      hi = mid - 1;
    } else {
      lo = mid + 1;
    }
  }
  if (ans1 == -1 or ans2 == -1) {
    cout << 0 << "\n";
    return 0;
  }
  if (((ans1 - ans2) < 0 ? -(ans1 - ans2) : (ans1 - ans2)) >= 1e18 - 10) {
    cout << -1;
    return 0;
  }
  if (ans1 < ans2)
    cout << 0;
  else
    cout << ans1 - ans2 + 1 << endl;
}
