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