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