def primeset(N): #N以下の素数をsetで求める.エラトステネスの篩O(√Nlog(N)) lsx = [1]*(N+1) for i in range(2,int(-(-N**0.5//1))+1): if lsx[i] == 1: for j in range(i,N//i+1): lsx[j*i] = 0 setprime = set() for i in range(2,N+1): if lsx[i] == 1: setprime.add(i) return setprime N,P = map(int,input().split()) if N <= 3: print(1) exit() al = N//2 lsp = list(primeset(al)) lsp.sort() ls = [0]*(N+1) for p in lsp: st = 1 while st*p <= N: ls[st*p] = 1 st += 1 if ls[P] == 0: print(1) else: print(sum(ls))