#include <bits/stdc++.h>
using namespace std;
void calcPrime(vector<int> &v) {
  int n = 1000000;
  vector<bool> p(n, true);
  p[0] = p[1] = false;
  for (int i = 2; i < n; i++) {
    if (!p[i]) continue;
    for (int j = i + i; j < n; j += i) {
      p[j] = false;
    }
  }
  for (int i = 0; i < n; i++)
    if (p[i]) v.push_back(i);
}
int main() {
  int a, b;
  cin >> a >> b;
  if (a < b)
    cout << "0" << endl;
  else if (a == b)
    cout << "infinity" << endl;
  else {
    int n = a - b, sq = sqrt(n), c = 0;
    for (int i = 1; i <= sq; i++) {
      if (n % i == 0) {
        if (i > b) c++;
        if (n / i > b) c++;
      }
    }
    if (sq > b && sq * sq == n) c--;
    cout << c << endl;
  }
  return 0;
}
