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