#include <bits/stdc++.h>
using namespace std;
const unsigned long long inf = (unsigned long long)1e18 + 1,
                         K = (unsigned long long)1e9;
unsigned long long Count(unsigned long long a, unsigned long long x,
                         unsigned long long b) {
  unsigned long long a0, a1, x0, x1;
  x1 = x / K, x0 = x % K;
  x0 *= a, x1 *= a;
  if (x1 > b) return K;
  x0 += x1 * K;
  return x0 / b;
}
unsigned long long a[100100], b[100100], c, x, xubnd = inf;
int n, cnt;
unsigned long long f(unsigned long long cx) {
  unsigned long long rv = 0;
  for (int i = 1; i <= n; i++) rv += Count(a[i], cx, b[i]) + 1;
  return rv;
}
unsigned long long bs(unsigned long long l, unsigned long long r) {
  unsigned long long temp;
  while (l < r) {
    temp = (l + r) >> 1;
    if (f(temp) < c)
      l = temp + 1;
    else
      r = temp;
  }
  return r;
}
int main() {
  ios_base::sync_with_stdio(false);
  int i;
  cin >> n >> c;
  for (i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    if (a[i] > 0) {
      swap(a[1], a[i]);
      swap(b[1], b[i]);
    }
  }
  x = bs((unsigned long long)1, inf);
  c++;
  xubnd = bs((unsigned long long)1, inf);
  cout << (xubnd - x);
  return 0;
}
