#include <bits/stdc++.h>
using namespace std;
long long A[10010];
long long B[10010];
long long N;
long long T(int i, long long x) {
  if (A[i] * x < B[i]) return 1;
  long long d = (A[i] * x - B[i]);
  long long q = d / B[i];
  long long r = d % B[i];
  d = q + 1;
  while ((A[i] * x - d * B[i]) < B[i]) d--;
  while ((A[i] * x - d * B[i]) >= B[i]) d++;
  return d + 1;
}
long long F(long long x) {
  if (x == 0) return 0;
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    ans += min(T(i, x), 1000000000000ll);
    if (ans > 1000000000000ll) ans = 1000000000000ll;
  }
  return ans;
}
long long mysearch(long long C) {
  long long low = 1;
  long long high = (10000000);
  while (low < high) {
    long long k = (low + high) / 2;
    if (F(k) >= C)
      high = k;
    else
      low = k + 1;
  }
  return low;
}
int main() {
  long long C;
  cin >> N >> C;
  for (int i = 0; i < N; i++) cin >> A[i] >> B[i];
  bool good = false;
  for (int i = 0; i < N; i++)
    if (A[i] > 0) good = true;
  if (!good) {
    long long check = F(0);
    if (check == C) {
      cout << -1 << endl;
    } else {
      cout << 0 << endl;
    }
    return 0;
  }
  long long x1 = mysearch(C);
  long long x2 = mysearch(C + 1);
  if (x1 == x2) {
    cout << 0 << endl;
    return 0;
  }
  assert(x1 <= x2);
  assert(F(x1) == C);
  assert(F(x1 - 1) < C);
  assert(F(x2) > C);
  assert(F(x2 - 1) == C);
  long long ans = (x2 - x1);
  cout << ans << endl;
}
