from collections import Counter import sys input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) INF = 2 ** 63 - 1 mod = 10 ** 9 + 7 from math import gcd def isprime(n): if n <= 2: return n == 2 if n % 2 == 0: return False s = 0 t = n - 1 while t % 2 == 0: s += 1 t //= 2 for a in [2, 3, 5, 7, 11, 13, 17, 19, 23, 31, 37]: if a >= n: break x = pow(a, t, n) if x == 1 or x == n - 1: continue for _ in range(s): x = (x * x) % n if x == n - 1: break if x == n - 1: continue return False return True def Pollad(N): if N % 2 == 0: return 2 if isprime(N): return N def f(x): return (x * x + 1) % N step = 0 while True: step += 1 x = step y = f(x) while True: p = gcd(y - x + N, N) if p == 0 or p == N: break if p != 1: return p x = f(x) y = f(f(y)) def Primefact(N): if N == 1: return [] q = [] q.append(N) ret = [] while q: now = q.pop() if now == 1: continue p = Pollad(now) if p == now: ret.append(p) else: q.append(p) q.append(now // p) return ret n, m = mi() D = Counter(Primefact(m)) def solve(n, c): dp = [[0] * 60 for _ in range(n)] for i in range(c + 1): dp[0][i] = 1 for i in range(n - 1): DP = [0] * 60 DP[0] = dp[i][0] for j in range(59): DP[j + 1] += DP[j] + dp[i][j + 1] DP[j + 1] %= mod for j in range(60): if j > c: break dp[i + 1][j] += DP[c - j] dp[i + 1][j] %= mod return sum(dp[n - 1]) % mod ans = 1 for v, c in D.items(): ans *= solve(n, c) ans %= mod print(ans)