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