#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int X, Y, ans = 0;
  cin >> X >> Y;
  if (Y == X)
    return cout << "infinity", 0;
  else {
    for (long long int A = 1; A * A <= (X - Y); A++) {
      if ((X - Y) % A == 0) {
        if (A > Y) ans++;
        if ((X - Y) / A > Y && A * A != X - Y) ans++;
      }
    }
  }
  cout << ans;
}
