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