#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 * 100 + 100;
const long long MAXD = 1000 * 1000ll * 1000 * 1000ll * 1000 * 1000 + 100;
;
long long a[MAXN], b[MAXN], n, c;
void input() {
  cin >> n >> c;
  for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];
}
long long days(long long x) {
  long long ans = 0;
  for (int i = 0; i < n; ++i) ans += 1 + x * a[i] / b[i];
  return ans;
}
long long lower(long long s, long long e) {
  if (s == e || s == e - 1) return e;
  long long mid = (s + e) / 2, now = days(mid);
  if (now < c) return lower(mid, e);
  return lower(s, mid);
}
long long upper(long long s, long long e) {
  if (s == e || s == e - 1) return e;
  long long mid = (s + e) / 2, now = days(mid);
  if (now > c) return upper(s, mid);
  return upper(mid, e);
}
int main() {
  input();
  long long x = lower(0, 1000 * 1000 * 1000);
  long long y = upper(0, 1000 * 1000 * 1000);
  cout << y - x << endl;
  return 0;
}
