#include <bits/stdc++.h>
using namespace std;
vector<int> p;
bool prime[100000];
int a, b;
int finddiv(int n) {
  int j = sqrt(n), sum = 0;
  for (int i = 1; i <= j; i++) {
    if (n % i == 0) {
      if (i > b) sum++;
      if (n / i > b) sum++;
    }
  }
  if (j * j == n && j > b) sum--;
  return sum;
}
int main() {
  cin >> a >> b;
  if (a < b)
    cout << "0";
  else if (a == b)
    cout << "infinity";
  else
    cout << finddiv(a - b);
  return 0;
}
