#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
int n, c;
int a[MAXN], b[MAXN];
unsigned long long l, r, res, ll, rr;
int main() {
  cin >> n >> c;
  for (int i = 0; i < (int)(n); i++) cin >> a[i] >> b[i];
  l = 0, r = (1LL << 63);
  r--;
  r <<= 1;
  r++;
  while (l < r - 1) {
    res = (l + r) >> 1;
    long long cur = 0;
    for (int i = 0; i < (int)(n); i++) {
      if ((res * a[i]) / b[i] + 1 >= c) {
        cur = -1;
        break;
      } else {
        cur += res * a[i] / b[i] + 1;
        if (cur >= c) {
          cur = -1;
          break;
        }
      }
    }
    if (cur == -1)
      r = res;
    else
      l = res;
  }
  ll = l;
  long long buf = 0;
  for (int i = 0; i < (int)(n); i++) {
    if ((ll * a[i]) / b[i] + 1 >= c) {
      buf = -1;
      break;
    } else {
      buf += ll * a[i] / b[i] + 1;
      if (buf >= c) {
        buf = -1;
        break;
      }
    }
  }
  if (buf < c) ll++;
  l = 0, r = (1LL << 63);
  r--;
  r <<= 1;
  r++;
  while (l < r - 1) {
    res = (l + r) >> 1;
    long long cur = 0;
    for (int i = 0; i < (int)(n); i++) {
      if ((res * a[i]) / b[i] + 1 > c) {
        cur = -1;
        break;
      } else {
        cur += res * a[i] / b[i] + 1;
        if (cur > c) {
          cur = -1;
          break;
        }
      }
    }
    if (cur == -1)
      r = res;
    else
      l = res;
  }
  rr = l;
  buf = 0;
  for (int i = 0; i < (int)(n); i++) {
    if ((rr * a[i]) / b[i] + 1 >= c) {
      buf = -1;
      break;
    } else {
      buf += rr * a[i] / b[i] + 1;
      if (buf >= c) {
        buf = -1;
        break;
      }
    }
  }
  if (buf <= c) rr++;
  cout << rr - ll << endl;
}
