#include <bits/stdc++.h>

using namespace std;

using Int = int;

struct ModInt {
    static constexpr Int mod = 1e9 + 7;
    Int v;

    ModInt(long long _v = 0) : v(set(_v)) {}
    ModInt(const ModInt &r) : v(set(r.v)) {}

    inline static Int set(const auto x) { return x < 0 ? (x % mod) + mod : x % mod; }
    inline void set() { v = set(v); }

    bool operator<(ModInt r) const { return v < r.v; }
    bool operator>(ModInt r) const { return r.v < v; }
    bool operator==(ModInt r) const { return v == r.v; }
    bool operator!= (ModInt r) const { return v != r.v; }

    ModInt operator-() const { return ModInt(v ? mod - v : v); }
    ModInt &operator=(const ModInt &r) { if (this != &r) v = set(r.v); return *this; }
    ModInt &operator+=(ModInt r) { (v += r.v) %= mod; return *this; }
    ModInt &operator-=(ModInt r) { (v -= r.v - mod) %= mod; return *this; }
    // ModInt &operator*=(ModInt r) { v = (__uint128_t(v) * r.v) % mod; return *this; }
    ModInt &operator*=(ModInt r) { v = 1ULL * v * r.v % mod; return *this; }
    ModInt &operator/=(ModInt r) { *this *= r.inv(); return *this; }
    ModInt operator+(ModInt r) const { return ModInt(*this) += r; }
    ModInt operator-(ModInt r) const { return ModInt(*this) -= r; }
    ModInt operator*(ModInt r) const { return ModInt(*this) *= r; }
    ModInt operator/(ModInt r) const { return ModInt(*this) /= r; }

    ModInt inv() const {
        long long a = v, b = mod, u = 1, w = 0;
        while (b) {
            long long t = a / b;
            std::swap(a -= t * b, b);
            std::swap(u -= t * w, w);
        }
        return ModInt(u);
    }

    ModInt pow(Int e) {
        ModInt a = *this, x(1);
        for ( ; 0 < e; e >>= 1) { if (e & 1) x *= a; a *= a; }
        return x;
    }
    inline ModInt pow(ModInt &e) { return pow(e.v); }
};

struct Combination {
    const Int mod = ModInt::mod, N;
    std::vector<ModInt> fact, inv_f;

    // MultiChoose を使用する場合は N = 2 * _n とする
    Combination(int _n) : N(_n < mod ? _n : mod - 1), fact(N + 1), inv_f(N + 1) {
        fact[0] = 1;
        for (int i = 1; i <= N; ++i) fact[i] = fact[i - 1] * i;
        inv_f[N] = fact[N].inv();
        for (int i = N; 1 <= i; --i) inv_f[i - 1] = inv_f[i] * i;
    }

    ModInt Fact(const int &n) const { return fact[n]; }
    ModInt InvFact(const int &n) const { return inv_f[n]; }

    ModInt Perm(const int &n, const int &k) const {
        if (k < 0 || n < k) return ModInt(0);
        else return fact[n] * inv_f[n - k];
    }
    ModInt Choose(const int &n, const int &k) const {
        if (n < 0 || k < 0 || n < k) return ModInt(0);
        else return fact[n] * inv_f[k] * inv_f[n - k];
    }
    ModInt MultiChoose(const int &n, const int &k) const {
        if (n < 0 || k < 0) return ModInt(0);
        else return k == 0 ? 1 : Choose(n + k - 1, k);
    }
};
std::ostream &operator<<(std::ostream &os, const ModInt &r) { return os << r.v; }
std::istream &operator>>(std::istream &is, ModInt &r) { is >> r.v; r.set();return is; }

template<class T>
std::vector<std::pair<T, T>> PrimeFact(T n) {
    std::vector<std::pair<T, T>> pf;
    T m = n;
    for (T i = 2; i * i <= n; ++i) {
        if (m % i != 0) continue;
        T cnt = 0;
        while (m % i == 0) { ++cnt; m /= i; }
        pf.emplace_back(std::make_pair(i, cnt));
    }
    if (1 < m) pf.emplace_back(std::make_pair(m, 1));

    return pf;
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false);

    Int n, m;
    cin >> n >> m;

    Combination cm(n + 50);
    auto pf = PrimeFact(m);

    ModInt res = 1;
    for (const auto &it : pf)
        res *= cm.MultiChoose(n, it.second);

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 1024