#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 11111;
int n, c;
long long a[MAX_N], b[MAX_N];
long long cal(long long x) {
  long long sum = n;
  for (int i = int(1); i <= int(n); ++i) {
    if (a[i] && x / b[i] > c / a[i]) return c + 1;
    sum += (x * a[i]) / b[i];
    if (sum > c) return c + 1;
  }
  return sum;
}
int main() {
  cin >> n >> c;
  long long sumA = 0;
  for (int i = int(1); i <= int(n); ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    a[i] = x;
    b[i] = y;
    sumA += x;
  }
  if (sumA == 0) {
    if (c == n)
      cout << -1;
    else
      cout << 0;
    return 0;
  }
  long long limit = 1000000000000000000ll;
  long long l = 1, r = limit, l0 = 0, r0 = -1;
  while (l <= r) {
    long long mid = (l + r) / 2, v = cal(mid);
    if (v >= c) {
      if (v == c) l0 = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  l = 1;
  r = limit;
  while (l <= r) {
    long long mid = (l + r) / 2, v = cal(mid);
    if (v <= c) {
      if (v == c) r0 = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  cout << r0 - l0 + 1;
  return 0;
}
