def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] #https://qiita.com/LorseKudos/items/9eb560494862c8b4eb56 N,K = map(int,input().split()) X = N-K divs = make_divisors(X) ans = 0 for x in divs: if N%x == K: ans += 1 print(ans)