#include <iostream>
#include <vector>
#include <utility>
#include <cmath>

constexpr long long order_of_field = 1e9 + 7;

//element of Z/pZ
class Modulo
{
private:
    long long p;
    long long n;
public:
    Modulo(): p(order_of_field), n(1) {}
    Modulo(long long n0);
    
    bool operator==(const Modulo rhs) const{return n == rhs.n;}
    Modulo& operator+=(const long long rhs);
    Modulo& operator+=(const Modulo& rhs);
    Modulo& operator*=(const long long rhs);
    Modulo& operator*=(const Modulo& rhs);
    Modulo& operator-=(const long long rhs);
    Modulo& operator-=(const Modulo& rhs);
    Modulo pow(const long long k) const;
    Modulo inverse() const;
    Modulo& operator/=(const long long rhs);
    Modulo& operator/=(const Modulo& rhs);
    long long get() const{return n;};
};

const Modulo operator+(const Modulo &lhs, const Modulo &rhs);
const Modulo operator+(const Modulo &lhs, const long long rhs);
const Modulo operator+(const long long lhs, const Modulo &rhs);
const Modulo operator*(const Modulo &lhs, const Modulo &rhs);
const Modulo operator*(const Modulo &lhs, const long long rhs);
const Modulo operator*(const long long lhs, const Modulo &rhs);

//constructor
Modulo::Modulo(long long n0)
{
    p = order_of_field;
    n = n0 >= 0 ? n0 % p : (p - (-n0 % p)) % p;
}

//operator +=
inline Modulo& Modulo::operator+=(const long long rhs)
{
    long long rhs1 = rhs >= 0 ? rhs % p : (p - (-rhs % p)) % p;
    n = (n + rhs1) % p;
    return *this;
}

inline Modulo& Modulo::operator+=(const Modulo& rhs)
{
    (*this) += rhs.n;
    return *this;
}

//operator *=
inline Modulo& Modulo::operator*=(const long long rhs)
{
    long long rhs1 = rhs >= 0 ? rhs % p : (p - (-rhs % p)) % p;
    n = (n * rhs1) % p;
    return *this;
}

inline Modulo& Modulo::operator*=(const Modulo& rhs)
{
    (*this) *= rhs.n;
    return *this;
}

//operator -=
inline Modulo& Modulo::operator-=(const long long rhs)
{
    return *this += -rhs;
}

inline Modulo& Modulo::operator-=(const Modulo& rhs)
{
    (*this) -= rhs.get();
    return *this; 
}

//(*this)**k
Modulo Modulo::pow(const long long k) const
{
    if(k == 0) return 1;
    if(k == 1) return n;
    long long k1 = k >= 0 ? k % (p-1) : ((p-1) - (-k % (p-1))) % (p-1);
    Modulo r = pow(k1/2);
    if(k1 % 2 == 0) return r * r;
    else return r * r * n; 
}

//(*this)**(-1)
Modulo Modulo::inverse() const
{
    return pow(-1);
}

//operator /=
inline Modulo& Modulo::operator/=(const long long rhs)
{
    Modulo inv = rhs;
    inv = inv.inverse();
    return *this *= inv;
}

inline Modulo& Modulo::operator/=(const Modulo& rhs)
{
    (*this) /= rhs.get();
    return *this; 
}

//operator +
const Modulo operator+(const Modulo &lhs, const Modulo &rhs)
{
    return Modulo(lhs.get()) += rhs;
}

const Modulo operator+(const Modulo &lhs, const long long rhs)
{
    return Modulo(lhs.get()) += rhs;
}

const Modulo operator+(const long long lhs, const Modulo &rhs)
{
    return Modulo(lhs) += rhs;
}

//operator *
const Modulo operator*(const Modulo &lhs, const Modulo &rhs)
{
    return Modulo(lhs.get()) *= rhs;
}

const Modulo operator*(const Modulo &lhs, const long long rhs)
{
    return Modulo(lhs.get()) *= rhs;
}

const Modulo operator*(const long long lhs, const Modulo &rhs)
{
    return Modulo(lhs) *= rhs;
}

//operator -
const Modulo operator-(const Modulo &lhs, const Modulo &rhs)
{
    return Modulo(lhs.get()) -= rhs;
}

const Modulo operator-(const Modulo &lhs, const long long rhs)
{
    return Modulo(lhs.get()) -= rhs;
}

const Modulo operator-(const long long lhs, const Modulo &rhs)
{
    return Modulo(lhs) -= rhs;
}

//operator /
const Modulo operator/(const Modulo &lhs, const Modulo &rhs)
{
    return Modulo(lhs.get()) /= rhs;
}

const Modulo operator/(const Modulo &lhs, const long long rhs)
{
    return Modulo(lhs.get()) /= rhs;
}

const Modulo operator/(const long long lhs, const Modulo &rhs)
{
    return Modulo(lhs) /= rhs;
}

//very very useful functions
//n**k
Modulo pow(Modulo n, long long k)
{
    Modulo tmp = n;
    tmp = tmp.pow(k);
    return tmp;
}

//n!
void fact_set(long long *base, int size)
{
    Modulo m = 1;
    if(size >= 0) base[0] = 1;
    for(int i=1; i<size; i++){
        m *= i;
        base[i] = m.get();
    }
}

//nCk
Modulo comb(long long n, long long k, long long *fact)
{
    Modulo a = fact[n];
    Modulo b = fact[k];
    Modulo c = fact[n-k];
    return a / b / c;
}

int main()
{
    typedef std::pair<int, int> P;
    int N;
    long long M;
    std::cin >> N >> M;

    int m = M;
    std::vector<P> prime; //(p_i, e_i)
    for(int i=2; i*i<=M; i++){
        int e = 0;
        while(m % i == 0){
            m /= i; e++;
        }
        if(e != 0) prime.push_back(P(i, e));
    }

    int size = N + 30;
    long long fact[size+1];
    fact_set(fact, size + 1);
    // printf("%d, %lld, fact= ", N, M);
    // for(int i=0; i<prime.back().first+1; i++) printf("%lld ", fact[i]);
    // printf("\n");
    Modulo ans = 1;
    for(auto &&itr = prime.begin(); itr != prime.end(); itr++){
        // std::cout << itr->first << " " << itr->second << std::endl;
        ans *= comb(N + itr->second - 1, itr->second, fact);
        // printf("ans = %lld\n", comb(N + itr->second - 1, itr->second, fact).get());
    }
    if(m > 1) ans *= N;
    std::cout << ans.get() << std::endl;
}

Measured memory_bytes: 1024