#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int i, n, j, a, b, c, k, m, fact, fact1, cnt = 0;
  cin >> a >> b;
  c = a - b;
  if (c == 0) {
    cout << "infinity";
    return 0;
  }
  if (b >= a) {
    cout << 0;
    return 0;
  }
  for (i = 1; i <= sqrt(c); i++) {
    if (c % i == 0) {
      fact1 = i;
      fact = c / i;
      if (fact != fact1) {
        if (fact > b) cnt++;
        if (fact1 > b) cnt++;
      } else {
        if (fact > b) cnt++;
      }
    }
  }
  cout << cnt;
  return 0;
}
