#include <bits/stdc++.h>
using namespace std;
long long int logy(long long int x, long long int y) {
  return ceil((long double)(log(x) / log(y)));
}
long long int powe(long long int a, long long int b) {
  long long int re = 1;
  while (b) {
    if (b & 1) re = (re * a);
    a = (a * a);
    b = b >> 1;
  }
  return re;
}
bool flag = 0, flag1 = 0, flag2 = 0;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int tt = 1;
  while (tt--) {
    long long int a, b;
    cin >> a >> b;
    if (a == b) {
      cout << "infinity";
      return 0;
    }
    a -= b;
    long long int ans = 0;
    for (long long int i = 1; i <= sqrt(a); i++) {
      if (a % i == 0) {
        if (a / i == i && i > b)
          ans++;
        else {
          if (i > b) ans++;
          if (a / i > b) ans++;
        }
      }
    }
    cout << ans;
  }
  return 0;
}
