#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long Inf = 1e18;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f * x;
}
int main(void) {
  int a, b;
  a = read();
  b = read();
  if (a == b)
    printf("infinity\n");
  else if (a < b)
    printf("0\n");
  else {
    int m = a - b;
    int cnt = 0;
    for (int i = 1; i * i <= m; i++) {
      if (m % i == 0 && i > b) cnt++;
      if (m % i == 0 && m / i != i && m / i > b) cnt++;
    }
    printf("%d\n", cnt);
  }
  return 0;
}
