#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
void solve() {
  long long a, b;
  cin >> a >> b;
  if (a == b) {
    cout << "infinity";
    return;
  }
  long long num = a - b;
  long long ans = 0;
  for (long long i = 1; i * i <= num; i++) {
    if (num % i == 0 && i > b) {
      ans++;
    }
    if (num % i == 0 && num / i > b) ans += (num / i != i);
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  srand(chrono::high_resolution_clock::now().time_since_epoch().count());
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
