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