N,P = map(int,input().split()) import sys if P == 1: print(1) exit() 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 print(ans)