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