#include <bits/stdc++.h>
using namespace std;
long long l, r, mid, ans;
int n, c, a[220000], b[220000], i;
long long check(long long mid) {
  long long res = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i] != 0 && mid / b[i] > c / a[i]) return 1e10;
    res += mid * a[i] / b[i];
  }
  return res;
}
int main() {
  scanf("%d%d", &n, &c);
  c -= n;
  for (i = 1; i <= n; ++i) scanf("%d%d", &a[i], &b[i]);
  l = 1;
  r = 1e18;
  while (l <= r) {
    mid = l + r >> 1;
    if (check(mid) >= c)
      r = mid - 1;
    else
      l = mid + 1;
  }
  ans = -(r + 1);
  l = 1;
  r = 1e18;
  while (l <= r) {
    mid = l + r >> 1;
    if (check(mid) <= c)
      l = mid + 1;
    else
      r = mid - 1;
  }
  ans += (l - 1);
  printf("%I64d\n", ans >= (long long)1e18 - 1 ? -1 : ans + 1);
}
