#include <bits/stdc++.h>
using namespace std;
int main() {
  long long ans = 0;
  int a, b, x;
  cin >> a >> b;
  if (a == b) {
    cout << "infinity\n";
    return 0;
  }
  if (b > a) {
    cout << "0\n";
    return 0;
  }
  x = a - b;
  int sq = (int)sqrt((double)x);
  for (int i = 1; i <= sq; ++i) {
    if (x % i == 0) {
      if (i > b) ans++;
      int aux = x / i;
      if (aux > b && aux != i) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
