N,M = map(int,input().split()) P = 10 ** 9 + 7 div = [] i = 1 while i * i <= M: if M % i == 0: div.append(i) if i != M // i: div.append(M // i) i += 1 n = len(div) s = set(div) G = [[] for _ in range(n)] for i in range(n): p = div[i] for j in range(n): q = div[j] if p * q in s: G[i].append(j) dp = [1] * n for _ in range(N - 1): nx = [0] * n for i in range(n): for j in G[i]: nx[j] += dp[i] for i in range(n): nx[i] %= P dp = nx ans = 0 for i in range(n): ans += dp[i] ans %= P print(ans)