import sys input = sys.stdin.readline from collections import Counter N,X=list(map(int,input().split())) X+=1 L=[] for x in range(1,10**5): if X%x==0: L.append(x) L.append(X//x) L=sorted(set(L)) DP=Counter() DP[2,X]=1 for i in range(N): NDP=Counter() for a,rest in DP: for l in L: if l>=a and rest%l==0: NDP[l,rest//l]+=DP[a,rest] DP=NDP ANS=0 for a,b in DP: if b==1: ANS+=DP[a,b] print(ANS)