from math import sqrt,ceil,floor def yaku(n):#nの約数を列挙するn <= 10 ** 12(order) rev = [] for i in range(1,ceil(sqrt(n))+1): if n % i == 0: rev.append(i) if n //i == i: continue rev.append(n//i) rev = list(set(rev)) return sorted(rev) N,M = map(int,input().split()) P = yaku(M) Pset = set(P) m = len(P) dp = [1] *m mod = 10 ** 9+ 7 for i in range(1,N): nx = [0] * m for p in range(m): for q in range(m): if P[p] * P[q] in Pset: nx[q] += dp[p] nx[q] %= mod dp = nx ans = 0 for p in range(m): ans += dp[p] ans %= mod print(ans)