#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
inline int read() {
  char ch = getchar();
  int num = 0;
  bool fl = 0;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') fl = 1;
  for (; isdigit(ch); ch = getchar()) num = (num << 1) + (num << 3) + ch - 48;
  if (fl) num = -num;
  return num;
}
inline void pt(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) pt(x / 10);
  putchar(x % 10 + '0');
}
const int maxn = 1e6 + 7;
int aa[maxn];
int bb[maxn];
int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(0);
  int a, b;
  cin >> a >> b;
  if (a == b) {
    cout << "infinity" << endl;
    return 0;
  }
  int len = 0;
  int sum = 0;
  int k = a - b;
  for (int i = 1; i * i <= k; i++) {
    if (k % i == 0) {
      if (i > b) {
        sum++;
      }
      if (k / i > b && k / i != i) {
        sum++;
      }
    }
  }
  cout << sum << endl;
  return 0;
}
