#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long maxn = 1e5 + 7;
const long long maxe = 1e6 + 7;
const long long INF = 1e18 + 7;
const double eps = 1e-8;
int dx[4] = {0, 0, 1, -1};
int dy[4] = {-1, 1, 0, 0};
int T;
int n, c;
int a[10000 + 5];
int b[10000 + 5];
long long C(long long x) {
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    long long k = x / b[i], left = x % b[i];
    long long cc = c - left * a[i] / b[i];
    if (a[i] && k > cc || k * a[i] > cc) return INF;
    sum += a[i] * x / b[i];
  }
  return sum;
}
int main() {
  scanf("%d%d", &n, &c);
  c -= n;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    sum += a[i];
  }
  if (sum == 0) {
    if (c == 0) {
      printf("-1\n");
    } else {
      printf("0\n");
    }
    return 0;
  }
  sum = 0;
  long long l = 1, r = INF, mid, ans = 0;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (C(mid) >= c) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  sum -= ans;
  l = 1, r = INF;
  ans = 0;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (C(mid) <= c) {
      l = mid + 1;
      ans = mid;
    } else {
      r = mid - 1;
    }
  }
  sum += ans;
  printf("%lld\n", sum + 1);
  return 0;
}
