#include <bits/stdc++.h>
#include <boost/functional/hash.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#define debug 0
#define esc(ret) cout << (ret) << endl,quick_exit(0)
#define fcout(d) cout << fixed << setprecision(d)
#define repU(i,s,t) for(int i = (int)(s); i <= (int)(t); ++i)
#define repD(i,s,t) for(int i = (int)(s); i >= (int)(t); --i)
#define rep(i,n) repU(i,0,(n) - 1)
#define rep1(i,n) repU(i,1,(n))
#define all(v) begin(v),end(v)
#define vct vector
#define prique priority_queue
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define ins insert
#define emp emplace
#define era erase
#define fir first
#define sec second
#define odd(x) ((x) & 1)
#define even(x) (!odd(x))

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<db,int> pdi;
typedef tuple<int,int,int> tiii;

const int dir[8][2] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const ll mod = 1e9 + 7;
const ll inf = (1LL << 62) - 1;

template <class T, class U> T qceil(T x, U y) { return x > 0 ? (x - 1) / y + 1 : x / y; }
template <class T, class U> bool parity(T x, U y) { return odd(x) ^ even(y); }
template <class T, class U> bool chmax(T &m, U x) { if(m < x) { m = x; return 1; } return 0; }
template <class T, class U> bool chmin(T &m, U x) { if(m > x) { m = x; return 1; } return 0; }
template <class T> bool cmprs(T &v) {
    T tmp = v;
    sort(all(tmp));
    tmp.erase(unique(all(tmp)),end(tmp));
    for(auto it = begin(v); it != end(v); ++it) *it = l_bnd(all(tmp),*it) - begin(tmp) + 1;
    return v.size() > tmp.size();
}

struct Table {
    ll md;
    vct<ll> fact_tbl,invfact_tbl;
    vct<vct<ll>> comb_tbl;

    Table(int n, ll m = mod) {
        md = m;
        fact_init(n);
        invfact_init(n);
        //comb_init(n);
    }

    ll fact(int x) {
        return fact_tbl[x];
    }

    ll invfact(int x) {
        return invfact_tbl[x];
    }

    ll comb(int x, int y) {
        if(x < y || y < 0) return 0;
        return comb_tbl[x][y];
    }

    void fact_init(int n) {
        fact_tbl.resize(n + 1);
        fact_tbl[0] = 1;
        rep1(i,n) fact_tbl[i] = fact_tbl[i - 1] * i % md;
    }

    void invfact_init(int n) {
        invfact_tbl.resize(n + 1);
        rep(i,n + 1) invfact_tbl[i] = modinv(fact(i));
    }

    void comb_init(int n) {
        comb_tbl.resize(n + 1);
        comb_tbl[0].assign(1,1);
        rep1(i,n) {
            comb_tbl[i].resize(i + 1);
            rep(j,i/2 + 1) {
                comb_tbl[i][j] = comb_tbl[i][i - j] = (comb(i - 1,j - 1) + comb(i - 1,j)) % md;
            }
        }
    }

    ll modpow(ll n, ll e) {
        n %= md,e %= md - 1;
        ll ret = 1;
        while(e) {
            if(e & 1) ret = ret * n % md;
            n = n * n % md;
            e /= 2;
        }
        return ret;
    }

    ll modinv(ll n) {
        return modpow(n,md - 2);
    }
};

Table t(100100);

ll cal(int n,int m){
    if(n < m || m < 0) return 0;
    return t.fact(n)*t.invfact(m)%mod*t.invfact(n-m)%mod;
}

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

    int n,m;cin>>n>>m;
    vct<int> ep;
    int c=0;
    while(m%2==0){
        c++,m/=2;
    }
    if(c) ep.pub(c);
    c=0;
    for(int d=3;d*d<=m;d+=2,c=0){
        while(m%d==0) c++,m/=d;
        if(c) ep.pub(c);
    }
    if(m>1) ep.pub(1);
    ll ans=1;
    for(int i:ep){
        ans*=cal(i+n-1,n-1);
        ans%=mod;
    }
    esc(ans);
}


Measured memory_bytes: 1792