#include <bits/stdc++.h>
using namespace std;
int a[10010], b[10010];
int n, c;
long long calc_time(long long x) {
  long long s = n;
  for (int i = 1; i <= n; i++) s += (long long)a[i] * x / b[i];
  return s;
}
void init() {
  cin >> n >> c;
  for (int i = 1; i <= n; i++) cin >> a[i] >> b[i];
}
void solve() {
  long long ans;
  long long l = 1, r = 10000;
  while (r >= l) {
    long long mid = (l + r) / 2;
    if (calc_time(mid) <= c)
      l = mid + 1;
    else
      r = mid - 1;
  }
  ans = r;
  l = 1, r = 10000;
  while (r >= l) {
    long long mid = (l + r) / 2;
    if (calc_time(mid) >= c)
      r = mid - 1;
    else
      l = mid + 1;
  }
  ans = ans - l + 1;
  if (calc_time(l) != c) ans = 0;
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  init();
  solve();
  return 0;
}
