#include <bits/stdc++.h>
using namespace std;
const int N = 10005;
const unsigned long long INF = (unsigned long long)5e18 + 1;
int n, c, a[N], b[N];
bool good(unsigned long long x, int tp) {
  unsigned long long sum = 0;
  for (int i = 0; i < n; i++) {
    if (INF / x < a[i]) return 1;
    if (sum > INF) return 1;
    sum += (x * a[i]) / b[i] + 1;
  }
  if (tp == 1) return sum >= c;
  return sum > c;
}
int main() {
  scanf("%d%d", &n, &c);
  for (int i = 0; i < n; i++) scanf("%d%d", a + i, b + i);
  unsigned long long l = 0, r = INF;
  while (r - l > 1) {
    unsigned long long m = (l + r) >> 1;
    if (good(m, 1))
      r = m;
    else
      l = m;
  }
  unsigned long long lb = r;
  l = 0, r = INF;
  while (r - l > 1) {
    unsigned long long m = (l + r) >> 1;
    if (good(m, 2))
      r = m;
    else
      l = m;
  }
  unsigned long long rb = l;
  if (rb == INF)
    cout << -1;
  else {
    if (lb == 0) lb = 1;
    cout << rb - lb + 1;
  }
  return 0;
}
