#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<int,P>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
map<int,int> ma;
int mypow(int a,int b){
	if(b==0) return 1;
	if(b%2) return mypow(a,b-1)*a%mod;
	int z=mypow(a,b/2);
	return z*z%mod;
}
int mutu(int a,int b){
	int x=1,y=1;
	f(i,b){
		x=x*(a-i)%mod;
		y=y*(i+1)%mod;
	}
	return x*mypow(y,mod-2)%mod;
}
signed main(){
	int n,m,ans=1;
	cin>>n>>m;
	for(int i=2;i*i<=m;i++){
		while(m%i==0){
			m/=i;
			ma[i]++;
		}
	}
	if(m!=1) ma[m]++;
	for(P p:ma){
		ans=ans*mutu(p.S+n-1,p.S)%mod;
	}
	cout<<ans<<endl;
    return 0;
}
