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