//
//  main.cpp
//
 
#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
 
template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a-1;i>=b;i--)

namespace Util {
int bipartite_match(size_t, size_t, const function<bool(size_t, size_t)>&);
int min_path_decomp_dag(size_t, const function<bool(size_t, size_t)>&);
int clamp_sum(int, int);
template<typename INT>
INT gcd_with_coef(INT x, INT y, INT* outCX, INT* outCY);
};	// namespace Util
 
struct Mod {
	static ll BASE;
	ll value = 0;
	static ll residue(ll value) { return (value % BASE + BASE) % BASE; }
	Mod(ll value)
	: value(residue(value)) {}
	Mod operator+(const Mod& rhs) const { return Mod(value + rhs.value); }
	void operator+=(const Mod& rhs) { *this = *this + rhs; }
	Mod operator-(const Mod& rhs) const { return Mod(value - rhs.value); }
	void operator-=(const Mod& rhs) { *this = *this - rhs; }
	Mod operator*(const Mod& rhs) const { return Mod(value * rhs.value); }
	void operator*=(const Mod& rhs) { *this = *this * rhs; }
	Mod operator/(const Mod& rhs) const { return *this * rhs.inv(); }
	void operator/=(const Mod& rhs) { *this = *this / rhs; }
	Mod inv() const {
		if (value == 0) {
			assert(false);
			throw "[Mod::inv] div by zero";
		}
		ll ans, sub;
		ll d = Util::gcd_with_coef<ll>(value, BASE, &ans, &sub);
		if (d != 1) {
			assert(false);
			throw "[Mod::inv] not invertible";
		}
		return ans;
	}
};
ll Mod::BASE = 1000000007;

template<typename INT>
INT Util::gcd_with_coef(INT x, INT y, INT* outCX, INT* outCY) {
	if (x < 0) {
		INT d = gcd_with_coef(-x, y, outCX, outCY);
		*outCX *= -1;
		return d;
	}
	if (y < 0) {
		INT d = gcd_with_coef(x, -y, outCX, outCY);
		*outCY *= -1;
		return d;
	}
	if (x > y) {
		return gcd_with_coef(y, x, outCY, outCX);
	}
	if (x == 0) {
		if (outCX != nullptr && outCY != nullptr) {
			*outCX = 0;
			*outCY = 1;
		}
		return y;
	}
	INT q = y / x;
	INT r = y % x;
	INT d = gcd_with_coef(r, x, outCY, outCX);
	if (outCX != nullptr && outCY != nullptr) {
		*outCX -= q * *outCY;
	}
	return d;
}

Mod binom(ll n, ll k) {
	Mod numer = 1;
	Mod denom = 1;
	rep(i,0,k) {
		numer *= (n - i);
		denom *= (i + 1);
	}
	return numer / denom;
}

int main() {
	ll N, M;
	cin >> N >> M;
	ll prime = 2;
	unordered_map<ll, ll> decomp;
	ll m = M;
	while (prime * prime <= M) {
		if (m % prime == 0) {
			decomp[prime]++;
			m /= prime;
		} else {
			prime++;
		}
	}
	if (m > 1) {
		decomp[m] = 1;
	}
	vector<ll> exps;
	for (auto kv : decomp) {
		ll e = kv.second;
		exps.push_back(e);
	}
	sort(exps.begin(), exps.end());
	ll e = 0;
	Mod b = 1; // binom(e+N-1, e);
	Mod ans = 1;
	rep(i,0,exps.size()) {
		while (e < exps[i]) {
			e++;
			b *= Mod(e+N-1) / Mod(e);
		}
		ans *= b;
	}
	cout << ans.value << endl;
}


Measured memory_bytes: 256