N,P = map(int,input().split()) div = [[] for _ in range(N + 1)] for i in range(2,N): for j in range(2 * i,N + 1,i): div[j].append(i) ans = 0 stack = [P] memo = [0] * (N + 1) memo[P] = 1 while stack: now = stack.pop() ans += 1 for d in div[now]: if memo[d] == 0: stack.append(d) memo[d] = 1 for j in range(2 * now,N + 1,now): if memo[j] == 0: memo[j] = 1 stack.append(j) print(ans)