mod=10**9+7 ##################### def mul(a,b): n=len(a) m=len(b[0]) res=[[0]*m for i in range(n)] for i in range(n): for j in range(m): for k in range(len(a[0])): res[i][j]+=a[i][k]*b[k][j] res[i][j]%=mod return res def mpow(a,n): N = len(a) if n == 0: res = [[0] * N for i in range(N)] for i in range(N): res[i][i] = 1 return res if n==1:return a res=mpow(a,n//2) res=mul(res,res) if n%2==1: res=mul(res,a) return res def det(A): a=[] for line in A: a.append(line[:]) n=len(a) f=1 for now in range(n): ind=-1 for i in range(now,n): a[i][now]%=mod if a[i][now]>0: ind=i break if ind==-1:return 0 a[now],a[ind]=a[ind],a[now] if now!=ind:f*=-1 f=f*a[now][now]%mod inv=pow(a[now][now],mod-2,mod) for j in range(now,n): a[now][j]*=inv a[now][j]%=mod for i in range(now+1,n): x=a[i][now] for j in range(now,n): a[i][j]-=a[now][j]*x a[i][j]%=mod for i in range(n): f*=a[i][i] f%=mod return f def minv(A): n=len(A) if det(A)==0:return -1 a=[] for i in range(n): e=[0]*n e[i]=1 a.append(A[i][:]+e) for now in range(n): ind = -1 for i in range(now, n): a[i][now] %= mod if a[i][now] > 0: ind = i break if ind == -1: return -1 a[now], a[ind] = a[ind], a[now] inv = pow(a[now][now], mod - 2, mod) for j in range(now, 2*n): a[now][j] *= inv a[now][j] %= mod for i in range(now + 1, n): x = a[i][now] for j in range(now, 2*n): a[i][j] -= a[now][j] * x a[i][j] %= mod for now in range(n-1,-1,-1): for i in range(now-1,-1,-1): x=a[i][now] for j in range(2*n): a[i][j]-=a[now][j]*x a[i][j]%=mod res=[] for l in a:res.append(l[n:]) return res ####################### from _collections import defaultdict n,m=map(int,input().split()) x=m d=defaultdict(int) for p in range(2,m+1): if p**2>x:break while x%p==0: x//=p d[p]+=1 if x>1:d[x]+=1 ans=1 for p in d: k=d[p] a=[[0]*(k+1) for i in range(k+1)] for x in range(k+1): for y in range(k+1): if x+y<=k: a[x][y]+=1 dp=[[0] for i in range(k+1)] dp[0][0]=1 a=mpow(a,n) dp=mul(a,dp) res=0 for x in range(k+1): res+=dp[x][0] ans*=res ans%=mod print(ans)