N,X = map(int,input().split()) ue = 10 ** 5 from functools import lru_cache #@lru_cache(maxsize = 100000) div = [] for i in range(2,ue): if (X + 1) % i == 0: div.append(i) t = len(div) """ @lru_cache(maxsize = 100000) def calc(n = N,inf = 0,x = X + 1): if div[inf] > x:return 0 if n == 1: return 1 ans = 0 for i in range(inf,t): u = div[i] if u > x:break if x % u == 0: ans += calc(n - 1,i,x // u) return ans """ stack = [] from collections import defaultdict d = defaultdict(int) stack.append((N,0,X + 1,1)) while stack: n,inf,x,flag = stack.pop() if div[inf] > x:continue if n == 1: d[(n,inf,x)] = 1 continue if flag == 1: stack.append((n,inf,x,-1)) for i in range(inf,t): u = div[i] if u > x:break if x % u == 0: stack.append((n - 1,i,x // u,1)) else: for i in range(inf,t): u = div[i] if u > x:break if x % u == 0: d[(n,inf,x)] += d[(n - 1,i,x // u)] print(d[(N,0,X + 1)])