#include <bits/stdc++.h>
using namespace std;
const long INF = (long)1e09;
long long n, m, j, k, ans = 0, c, t;
vector<long long> a, b;
bool f;
int main() {
  scanf("%I64d %I64d", &n, &c);
  for (long i = 0; i < n; i++) {
    long long x, y;
    scanf("%I64d %I64d", &x, &y);
    a.push_back(x);
    b.push_back(y);
  }
  for (long x = 1; x < 4000000; x++) {
    f = 1;
    k = 0;
    for (long i = 0; i < n; i++) {
      t = a[i] * x;
      k += t / b[i] + 1;
      if (k > c) {
        f = 0;
        break;
      }
    }
    if (k != c) f = 0;
    if (f) ans++;
  }
  printf("%I64d", ans);
  return 0;
}
