#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct _OMAZINAI_ { _OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } __omazinai_instance__;
#define INF ((1LL<<61) + (1<<29))
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
#define OddEven(x) {std::cout << ((x)%2?"Odd":"Even") << std::endl;}
#define ODDEVEN(x) {std::cout << ((x)%2?"ODD":"EVEN") << std::endl;}
typedef long long int ll;
ll my_gcd(ll a, ll b) { return b ? my_gcd(b, a%b) : a; };
void _INPUT_IMPL_() {};
template <class T, class... Args> void _INPUT_IMPL_(T& dest, Args&... args) { cin >> dest; _INPUT_IMPL_(args...); }
void _OUTPUT_IMPL_() {};
template <class T, class... Args> void _OUTPUT_IMPL_(T dest, Args... args) { cout<< dest << (sizeof...(Args)?" ":""); _OUTPUT_IMPL_(args...); }
#define in(type, ...) type __VA_ARGS__; _INPUT_IMPL_(__VA_ARGS__)
#define in_v(type, name, cnt) vector<type> name(cnt); loop(i, cnt) cin >> name[i];
#define sort_v(v) std::sort(v.begin(), v.end())
#define out(...) (_OUTPUT_IMPL_(__VA_ARGS__), std::cout<<std::endl)
#define set_fix(x) ((std::cerr<<std::fixed<<std::setprecision(x)),(std::cout<<std::fixed<<std::setprecision(x)))
//小さい方に寄る
#define space_op(x, y, a, b, c) ([](auto x_, auto y_, auto a_, auto b_, auto c_){if(x_<y_)return a_;if(x_>y_)return c_;return b_;}(x,y,a,b,c))
#define space_out(x, y, a, b, c) out(space_op(x, y, a, b, c))
#define MOD ((ll)(1e9+7))

/*#define rep loop

ll mod = 1000000007;
//---------------------------------------------------------------------------------------------------
ll f[101010];
void init() {
	f[0] = 1;
	rep(i, 1, 101010) f[i] = (f[i - 1] * i) % mod;
}
//---------------------------------------------------------------------------------------------------
ll inv(ll x) {
	ll res = 1;
	ll k = mod - 2;
	ll y = x;
	while (k) {
		if (k & 1) res = (res * y) % mod;
		y = (y * y) % mod;
		k /= 2;
	}
	return res;
}
//---------------------------------------------------------------------------------------------------
ll C(ll n, ll k) {
	ll a = f[n]; // = n!
	ll b = f[n - k]; // = (n-k)!
	ll c = f[k]; // = k!

	ll bc = (b * c) % mod;

	return (a * inv(bc)) % mod;
}*/

const ll mod = 1e9 + 7;
ll f[200010] = { 0 }; // f(n) = (n!) % mod
ll mod_pow(ll x, ll n) {
	ll res = 1LL;
	while (n > 0) {
		if (n & 1) res = res * x % mod;
		x = x * x % mod;
		n >>= 1;
	}
	return res;
}
ll mod_inv(ll x) {
	return mod_pow(x, mod - 2) % mod;
}
ll Comb(ll n, ll r) {
	return (((f[n] * mod_inv(f[r])) % mod) * mod_inv(f[n - r])) % mod;
}
void init() {
	f[0] = f[1] = 1;
	for (int i = 2; i <= 200005; ++i) f[i] = (i * f[i - 1]) % mod;
	//ll res = Comb(h + w - 2, h - 1);
}


ll H(ll n, ll k) {
	return Comb(n + k - 1, k);
}

int main() {
	init();
	//std::cerr << Comb(10, 2) << std::endl;
	in(ll, Num, M);
	map<ll, ll> fac;
	//bool isPrime = true;

	auto ins = [&](ll num) {
		if (fac.count(num)) ++fac[num];
		else fac[num] = 1;
	};


	for (ll i = 2; i*i <= M;) {
		if (M % i == 0) {
			//std::cerr << "% : " << i << std::endl;
			ins(i);
			//isPrime = false;
			//--------
			M /= i;
		}
		else ++i;
	}
	if(M!=1) ins(M);
	ll res = 1;
	for (auto np : fac) {
		//std::cerr << Num << " | " << np.first << " : " << np.second << std::endl;
		//std::cerr << H(Num, np.second) << std::endl;
		res *= H(Num, np.second);
		res %= mod;
	};
	out(res);
}

Measured memory_bytes: 1792