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