#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, c;
  cin >> n >> c;
  c -= n;
  vector<int> a(n);
  vector<int> b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  int cnt = 0;
  for (long long x = 1; x <= 20000; x++) {
    long long s = 0;
    for (int i = 0; i < n; i++) {
      s += x * a[i] / b[i];
    }
    if (s == c) cnt++;
  }
  if (cnt == 20000) cnt = -1;
  cout << cnt;
}
