#include <bits/stdc++.h>
using namespace std;
int a[10000];
int b[10000];
int main() {
  int n, c;
  scanf("%d", &n);
  ;
  scanf("%d", &c);
  ;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    ;
    scanf("%d", &b[i]);
    ;
  }
  long long t;
  int r = 0;
  for (int x = 1; x <= 1000000; x++) {
    t = 0;
    for (int i = 0; i < n; i++) t += (x * a[i]) / b[i];
    if (t == (c - n)) r++;
  }
  cout << r;
  return 0;
}
