#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef string str;
const long long INF = INT64_MAX;
const long long MOD = (ll) 1e9+7;

#define REP(i, n) for(ll i=0;i<n;i++)
#define ASC(v) sort((v).begin(), (v).end())
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse((v).rbegin(), (v).rend())
#define FOLDL(src, dst, lambda) partial_sum((src).begin(), (src).end(), (dst).begin(), lambda)
#define ACCUM(v, d0, lambda) accumulate((v).begin(), (v).end(), d0, lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum((src).begin(), (src).end(), (dst).begin(), lambda);INV(dst)
#define DESC(v) sort((v).rbegin(), (v).rend())
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);erase(unique(v.begin(), v.end()), v.end())
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
// 剰余を考慮した整数のクラス
template <uint_fast64_t Mod> class Mint {
    using u64 = uint64_t;
    public:
    u64 a;
    constexpr Mint(const u64 x = 0) noexcept : a(x % Mod){}
    constexpr void set(const u64 x = 0) noexcept { a = x % Mod; }
    constexpr u64 &value() noexcept { return a; }
    constexpr const u64 &value() const noexcept { return a; }
    constexpr Mint operator+(const Mint rhs) const noexcept {
        return Mint(*this) += rhs;
    }
    constexpr Mint operator-(const Mint rhs) const noexcept {
        return Mint(*this) -= rhs;
    }
    constexpr Mint operator*(const Mint rhs) const noexcept {
        return Mint(*this) *= rhs;
    }
    constexpr Mint operator/(const Mint rhs) const noexcept {
        return Mint(*this) /= rhs;
    }
    constexpr Mint &operator+=(const Mint rhs) noexcept {
        a += rhs.a;
        if (a >= Mod) a -= Mod;
        return *this;
    }
    constexpr Mint &operator++() noexcept {
        a += 1;
        if (a >= Mod) a -= Mod;
        return *this;
    }
    constexpr Mint operator++(int) noexcept {
        Mint m = *this;
        a += 1;
        if (a >= Mod) a -= Mod;
        return m;
    }
    constexpr Mint &operator-=(const Mint rhs) noexcept {
        if (a < rhs.a) a += Mod;
        a -= rhs.a;
        return *this;
    }
    constexpr Mint &operator--() noexcept {
        if (a < 0) a += Mod;
        a -= 1;
        return *this;
    }
    constexpr Mint operator--(int) noexcept {
        Mint m = *this;
        if (a < 0) a += Mod;
        a -= 1;
        return m;
    }
    constexpr Mint &operator*=(const Mint rhs) noexcept {
        a = a * rhs.a % Mod;
        return *this;
    }
    constexpr Mint &operator/=(const Mint rhs) noexcept {
        u64 exp = Mod - 2;
        while(exp) {
            if(exp % 2) {
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return *this;
    }
    constexpr operator long long() const {return a;}
    friend ostream& operator<< (ostream& os, const Mint<Mod> &m) {
        os << m.a;
        return os;
    };
    friend istream& operator>> (istream& is, Mint<Mod> &m) {
        long long l;
        is >> l;
        m.set(l);
        return is;
    };
};
typedef Mint<MOD> mint;
typedef vector<Mint<MOD>> vmint;
// 階乗の剰余
vmint factional(const int m) {
    vmint ret;
    mint n = 1;
    ret.push_back(n);
    for(mint i = 1; i.a <= m; i++)
    {
        n *= i;
        ret.push_back(n);
    }
    return ret;
}
// 繰り返し二乗和
mint RepSqMod(long long N, long long P) {
    if(P==0) return mint(1);
    if(P % 2 == 0) {
        mint t = RepSqMod(N, P / 2);
        return t * t;
    }
    return mint(N * RepSqMod(N, P - 1)).value();
}

// 階乗の剰余の逆元
vmint invfactional(const int m) {
    vmint ret;
    mint n = 1;
    ret.push_back(n);
    for(mint i = 1; i.a <= m; i++)
    {
        n *= i;
        ret.push_back(RepSqMod(n, MOD - 2));
    }
    return ret;
}

// 二項係数の剰余
mint ModComb(long long n, long long r, vmint fac, vmint inv) {
    return fac[n] * inv[r] * inv[n - r];
}

pll factor_sub(ll n, ll m)
{
	ll i = 0;
	while (n % m == 0)
	{
		i++;
		n /= m;
	}
	return make_pair(i, n);
}

vpll factorization(ll n)
{
	vpll a;
	ll c, m;
	tie(c, m) = factor_sub(n, 2);
	if (c > 0)
		a.push_back(make_pair(2, c));
	for (ll i = 3; m >= i * i; i += 2)
	{
		tie(c, m) = factor_sub(m, i);
		if (c > 0)
			a.push_back(make_pair(i, c));
	}
	if (m > 1)
		a.push_back(make_pair(m, 1));
	return a;
}


void solve() {
    ll N, M;
    cin >> N >> M;
    vpll fs = factorization(M);
    vmint fac = factional(100100);
    vmint inv = invfactional(100100);
    mint ans = 1;
    for(auto &f:fs) {
        ll x = f.second;
        ans *= ModComb(x + N - 1, x, fac, inv);
    }
    cout << ans << endl;
}

int main() {
    FIO;
    solve();
    return 0;
}


Measured memory_bytes: 3572