#include <bits/stdc++.h>
using namespace std;
map<int, int> chk;
int a, b, cnt;
int main() {
  cin >> a >> b;
  if (a == b) {
    cout << "infinity";
    return 0;
  }
  if (a < b) {
    cout << 0 << "\n";
    return 0;
  }
  a -= b;
  int len = sqrt(a);
  for (int i = 1; i <= len; i++) {
    if (a % i == 0) {
      if (!chk[i]) {
        if (i > b) cnt++;
        chk[i] = 1;
      }
      if (i != a / i && !chk[a / i]) {
        if (a / i > b) cnt++;
        chk[a / i] = 1;
      }
    }
  }
  cout << cnt;
}
