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