#include <bits/stdc++.h>
using namespace std;
bool in[10][11];
void init() {
  memset(in, false, sizeof(in));
  in[0][7] = true;
  in[0][1] = true;
  in[3][1] = true;
  in[3][7] = true;
  in[4][1] = true;
  in[6][5] = true;
  in[7][1] = true;
  for (int i = 0; i < 10; i++) in[8][i] = true;
  in[9][1] = true;
  in[9][3] = true;
  in[9][4] = true;
  in[9][5] = true;
  in[9][7] = true;
  for (int i = 0; i < 10; i++) in[i][i] = true;
}
bool cmp(int n1, int n2, int x1, int x2) { return (in[x1][n1] && in[x2][n2]); }
int main() {
  init();
  if (0) {
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
  }
  long long x, a, b, r = 0, x1, x2, n1, n2;
  cin >> a >> b;
  if (a == b) {
    cout << "infinity";
    return 0;
  }
  if (b > a) {
    cout << "0";
    return 0;
  }
  x = a - b;
  long long maxx = 1 + floor(pow(x, 0.5));
  for (x1 = 1; x1 < maxx; x1++)
    if ((x % x1 == 0)) {
      x2 = x / x1;
      if (x1 > b) r++;
      if ((x2 > b) && (x2 != x1)) r++;
    }
  cout << r;
}
