#include <bits/stdc++.h>
using namespace std;
typedef priority_queue<pair<int, int>, vector<pair<int, int>>,
                       greater<pair<int, int>>>
    rpqpi;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long a, b, k;
  cin >> a >> b;
  if (a == b) {
    cout << "infinity" << '\n';
  } else if (a < b) {
    cout << 0 << '\n';
  } else {
    k = a - b;
    set<int> c;
    for (long long i = 1; i * i <= k; ++i) {
      if (k % i == 0) {
        if (i > b) c.insert(i);
        if (k / i > b) c.insert(k / i);
      }
    }
    cout << c.size() << '\n';
  }
  return 0;
}
