N,M = map(int,input().split()) C = 10 ** 6 + 2 P = 10 ** 9 + 7 dat = [0] * C ans = 1 for i in range(2,C): if dat[i] == 0: for j in range(2 * i,C,i): dat[j] = 1 if M % i == 0: M //= i count = 1 while M % i == 0: count += 1 M //= i dp = [1] * (count + 1) for _ in range(N-1): nx = [0] * (count + 1) S = [0] * (count + 1) S[0] = dp[0] for k in range(1,count + 1): S[k] = dp[k] + S[k-1] S[k] %= P for k in range(count + 1): nx[k] = S[count - k] dp = nx ans = ans * sum(dp) % P from functools import lru_cache @lru_cache def calc(count): dp = [1] * (count + 1) for _ in range(N - 1): nx = [0] * (count + 1) S = [0] * (count + 1) S[0] = dp[0] for k in range(1,count + 1): S[k] = dp[k] + S[k-1] S[k] %= P for k in range(count + 1): nx[k] = S[count - k] dp = nx return sum(dp) % P if M != 1: ans = ans * calc(1) % P print(ans)