#include <bits/stdc++.h>
int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  if (a < b) {
    printf("0");
    return 0;
  } else if (a == b) {
    printf("infinity");
    return 0;
  }
  int d = a - b;
  int q = 1;
  int sol = 0;
  while (d / q > b) {
    if (d % q) {
      q++;
      continue;
    }
    int x = d / q;
    if (x < q) break;
    if (x <= b) break;
    if (q > b && x != q) sol++;
    sol++;
    q++;
  }
  printf("%d", sol);
  return 0;
}
