#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:65777216")
using namespace std;
const int N = 111111;
const int INF = 111111111;
const double eps = 1e-9;
const double pi = 3.14159265358979;
int n, c, a[N], b[N], ans;
int main() {
  cin >> n >> c;
  for (int i = 1; i <= (n); i++) cin >> a[i] >> b[i];
  for (int x = 1;; x++) {
    int cur = 0;
    for (int i = 1; i <= (n); i++) {
      cur += (x * a[i]) / b[i] + 1;
      if (cur > c) break;
    }
    if (cur == c) ++ans;
    if (cur > c) break;
  }
  cout << ans << endl;
  return 0;
}
