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