from collections import defaultdict 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 = defaultdict(lambda: 0) cnt = 0 while maxA > 1: for p in primeSet: if maxA % p == 0: pFactor[p] += 1 maxA //= p cnt += 1 continue if cnt == 0: pFactor[maxA] += 1 break temp = 1 for k in pFactor.keys(): temp *= (1+pFactor[k]) ans += temp print(ans)