#include <bits/stdc++.h>
using namespace std;
const long long K = 10000;
long long a[100100], b[100100], c, x, cs;
int n, cnt;
int main() {
  ios_base::sync_with_stdio(false);
  int i;
  cin >> n >> c;
  for (i = 1; i <= n; i++) cin >> a[i] >> b[i];
  for (x = 1; x <= K; x++) {
    for (cs = 0, i = 1; i <= n; i++) cs += (a[i] * x / b[i]) + 1;
    if (cs == c) cnt++;
  }
  cout << cnt;
  return 0;
}
