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