#include <bits/stdc++.h>
using namespace std;
struct Node {
  long long A;
  long long B;
};
Node lib[10005];
int main(void) {
  long long c;
  int n;
  scanf("%d%I64d", &n, &c);
  c = c - (long long)n;
  long long m = 0;
  for (int i = 1; (i) <= (n); (i)++) {
    scanf("%I64d%I64d", &lib[i].A, &lib[i].B);
    if (m < lib[i].B) m = lib[i].B;
  }
  long long time = 0;
  for (int i = 1; i <= (m + 1LL) * (c + 1); i++) {
    long long check = 0;
    for (int j = 1; (j) <= (n); (j)++) check += (i * lib[j].A / lib[j].B);
    if (check == c) time++;
  }
  printf("%I64d\n", time);
}
