#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

vector<vector<ll>> c;

ll comb(ll n, ll m, ll mod){
    if(m > n-m) m = n - m;
    if(c[n][m] != -1) return c[n][m];
    if(n==m || m==0){
        c[n][m] = 1;
    }else{
        c[n][m] = (comb(n-1,m-1, mod) + comb(n-1,m, mod))%mod;
    }
    return c[n][m];
}


int main(){
    int N, M;
    cin >> N >> M;
    vector<ll> a;
    for(int i=2; i*i<=M; i++){
        ll cnt = 0;
        while(M%i==0){
            M/=i;
            cnt++;
        }
        if(cnt!=0) a.push_back(cnt);
    }
    if(M!=1) a.push_back(1);

    int alen = a.size();
    ll aMax = 0;
    for(int i=0; i<alen; i++){
        aMax = max(aMax, a[i]);
    }
    c = vector<vector<ll>>(N+aMax+1, vector<ll>(aMax+1, -1));
    ll ans = 1;
    int mod = 1e9+7;
    for(int i=0; i<alen; i++){
        ans = (ans*comb(a[i]+N-1, a[i], mod))%mod;
    }
    cout << ans << endl;
}
