#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, j, a, b, x, m, c;
  scanf("%I64d %I64d", &a, &b);
  c = 0;
  n = a - b;
  if (a == b)
    cout << "infinity" << endl;
  else if (a < b)
    cout << "0" << endl;
  else {
    for (i = 1; i * i <= n; i++) {
      if (n % i == 0 && i > b) c++;
      if (n % i == 0 && n / i > b && i * i != n) c++;
    }
    cout << c << endl;
  }
  return 0;
}
