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