#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int maxn = 234567;
int mul(long long a, long long b){
	return a * b % mod;
}
int inv(int x){
	int r = 1, m = mod - 2;
	for(; m; m >>= 1, x = mul(x, x)) if(m&1) r = mul(r, x);
	return r;
}
int fat[maxn], ifat[maxn];
void init(){
	fat[0] = 1;
	for(int i = 1; i < maxn; i++) fat[i] = mul(fat[i - 1], i);
	ifat[maxn - 1] = inv(fat[maxn - 1]);
	for(int i = maxn - 2; i >= 0; i--) ifat[i] = mul(ifat[i + 1], i + 1);
}
int ncr(int n, int r){
	if(n < r) return 0;
	return mul(fat[n], mul(ifat[r], ifat[n - r]));
}
int main(){
	init();
	int n, m; cin >> n >> m;
	map<int,int> foo;
	for(int i = 2; i * i <= m; i++){
		while(m%i == 0){
			foo[i]++;
			m /= i;
		}
	}
	if(m != 1) foo[m]++;
	int ans = 1;
	for(auto it : foo) ans = mul(ans, ncr(n + it.second - 1, it.second));
	cout << ans << endl;
	return 0;
}
