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