#include <bits/stdc++.h>
const int N = 10010;
const long long inf = 1e18;
using namespace std;
int n;
long long a[N], b[N], c;
long long check(long long x) {
  long long ret = 0;
  for (int i = 0; i < n; i++)
    if (a[i] > inf / (x + 1))
      return inf;
    else
      ret += (a[i] * x / b[i] + 1);
  return ret;
}
int main() {
  cin >> n >> c;
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  long long l = 0, r = inf, retl = -1, retr = -1;
  if (n > c) {
    cout << 0 << endl;
    return 0;
  }
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (check(mid) >= c)
      r = mid - 1, retl = mid;
    else
      l = mid + 1;
  }
  if (retl == 0) retl++;
  l = 0, r = inf;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (check(mid) > c)
      r = mid - 1;
    else
      l = mid + 1, retr = mid;
  }
  cout << retr - retl + 1 << endl;
  return 0;
}
