#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int a, b;
  cin >> a >> b;
  if (a <= b) {
    cout << (a < b ? "0" : "infinity") << endl;
    return 0;
  }
  int ab = a - b, res = 0;
  for (int i = 1; i * i <= ab; i++) {
    if (ab % i == 0) {
      int j = ab / i;
      res += (int)(i > b) + (j > b && i != j);
    }
  }
  cout << res << endl;
  return 0;
}
