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