#include <bits/stdc++.h>
using namespace std;
int main() {
  int i = 0, x = 0, y = 0, z = 0, t = 0, d = 0, a, b;
  cin >> a >> b;
  if (a == b) {
    cout << "infinity" << endl;
    return 0;
  }
  a = a - b;
  for (i = 1; i <= (int)sqrt((double)a); i++) {
    if (a % i == 0) {
      x = i;
      y = a / i;
      if (x == y) {
        if (x > b) z++;
      } else {
        if (x > b) z++;
        if (y > b) z++;
      }
    }
  }
  cout << z << endl;
  return 0;
}
