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[j] = False primeSet.add(i) # print(sorted(primeSet)) ans = 0 pFactor = defaultdict(lambda: 0) cnt = 0 while maxA > 1: flag = False # print(pFactor) for p in primeSet: if maxA % p == 0: pFactor[p] += 1 maxA //= p cnt += 1 flag = True continue if cnt == 0: pFactor[maxA] += 1 if not flag: break facSet = set() pKey = sorted(pFactor.keys()) # print(pKey) def recurPrime(pIndex, n): if pIndex == len(pKey): facSet.add(n) else: for i2 in range(pFactor[pKey[pIndex]]+1): recurPrime(pIndex+1, n*(int(pKey[pIndex])**i2)) if len(pKey) > 0: for i in range(pFactor[pKey[0]]+1): recurPrime(1, pKey[0]**i) else: if n == 1 and k == 0: ans = 1 else: ans = 0 facRemove = set() for f in facSet: if f <= k: facRemove.add(f) facSet = facSet - facRemove # print(facSet) ans += len(facSet) print(ans)