#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 7;
const long long BIG = 1e18;
int n, c;
int a[N], b[N];
void input() {
  scanf("%d %d", &n, &c);
  for (int i = (0); i < (n); i++) {
    scanf("%d %d", &a[i], &b[i]);
  }
}
int comp(long long M) {
  long long sum = 0;
  for (int i = (0); i < (n); i++) {
    if (M and a[i] > BIG / M) {
      return 1;
    }
    sum += M * a[i] / b[i] + 1;
  }
  return (sum == c ? 0 : sum < c ? -1 : 1);
}
void solve() {
  long long L1 = 0, R1 = BIG;
  while (L1 < R1) {
    long long M = (L1 + R1 + 1) / 2;
    comp(M) < 0 ? L1 = M : R1 = M - 1;
  }
  long long L2 = 0, R2 = BIG;
  while (L2 < R2) {
    long long M = (L2 + R2 + 1) / 2;
    comp(M) <= 0 ? L2 = M : R2 = M - 1;
  }
  long long res = L2 - L1;
  printf("%lld\n", (res < BIG ? res : -1));
}
int main() {
  {
    input();
    solve();
  }
  return 0;
}
