#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long a, b;
  cin >> a >> b;
  if (a < b) {
    cout << 0 << endl;
  } else if (a == b) {
    cout << "infinity" << endl;
  } else {
    set<long long> sol;
    for (long long i = 1; i * i <= (a - b); i++) {
      if ((a - b) % i == 0) {
        if (i > b) {
          sol.insert(i);
        }
        if ((a - b) / i > b) {
          sol.insert((a - b) / i);
        }
      }
    }
    cout << sol.size() << endl;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
}
