#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
int cx[] = {-1, 1, 0, 0, 1, 1, -1, -1};
int cy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int main(void) {
  ios::sync_with_stdio(0);
  int a, b;
  cin >> a >> b;
  if (b > a)
    cout << 0 << endl;
  else if (b == a)
    cout << "infinity" << endl;
  else {
    a -= b;
    int counter = 0;
    for (int i = 1; i * i <= a; i++) {
      if (a % i == 0) {
        if (i > b) counter++;
        if (a / i > b) counter++;
      }
    }
    if ((float)sqrt(a) * sqrt(a) == a && sqrt(a) > b) counter--;
    cout << counter << endl;
  }
  return 0;
}
