#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 61;
int n;
long long a[10000], b[10000];
long long f(long long x) {
  long long res = 0;
  for (int i = 0; i < (n); i++) res += 1 + a[i] * x / b[i];
  return res;
}
int main() {
  long long tar;
  cin >> n >> tar;
  for (int i = 0; i < (n); i++) cin >> a[i] >> b[i];
  long long ans = 0;
  for (long long x = 1; x <= 1000000; x++) {
    if (f(x) == tar) ans++;
  }
  cout << ans << endl;
  return 0;
}
