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