#include <bits/stdc++.h>
using namespace std;
int n, c, res, x, a[101], b[101], i, j;
bool solve(int x) {
  int day = 0;
  for (int i = 1; i <= n; i++) {
    int r = a[i] * x;
    day += r / b[i];
  }
  return day + n == c;
}
int main() {
  cin >> n >> c;
  for (i = 1; i <= n; i++) cin >> a[i] >> b[i];
  for (x = 1; x <= 100000; x++) res += solve(x);
  cout << res << endl;
}
