n, k = list(map(int, input().split())) maxA = n-k primeSet = set() primeList = [True] * int(3 + maxA ** 0.5) primeList[1] = False primeList[2] = True primeSet.add(2) for i in range(4, len(primeList), 2): primeList[i] = False for i in range(3, len(primeList)): if primeList[i] == True: for j in range(i*2, len(primeList), i): primeList[i] = False primeSet.add(i) ans = 1 if k == 0: ans += 1 pFactor = [] while maxA > 1: for p in primeSet: if maxA % p == 0: pFactor.append(p) maxA //= p continue break ans += len(pFactor) print(ans)