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