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