#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = int_fast64_t;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

constexpr int MOD = 1'000'000'007;

// 1 <= k <= n <= 10^7
#define CNKMAX 110001
class CNK1 {
    std::vector<long long> fac, finv, inv;
    int MOD;
public:
    CNK1(int mod = 1000000007): MOD(mod), fac(CNKMAX), finv(CNKMAX), inv(CNKMAX) {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < CNKMAX; i++){
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }
    int get(const int &n, const int &k) const {
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }
};

long long power(long long x, long long n, long long mod = 1000000007) {
    if (n == 0) return 1;
    if (n % 2 == 0) return power(x * x % mod, n/2, mod);
    else return x * power(x, n-1, mod) % mod;
}

LL cnk(const LL &n, const LL &k) {
    LL ret = 1, inv = 1;
    REP(i,2,n+1) ret = (ret * i) % MOD;
    REP(i,2,k+1) inv = (inv * i) % MOD;
    REP(i,2,(n-k)+1) inv = (inv * i) % MOD;
    return (ret * power(inv, MOD-2)) % MOD;
}

void solve() {
    LL n, m;
    cin >> n >> m;
    //VI ps(100000);
    map<int,int> ps;
    
    if (n == 1 || m == 1) {
        cout << 1 << endl;
        return;
    }
    
    for (int i = 2; i <= m; ++i) {
        if (m % i == 0) {
            ++ps[i];
            m /= i;
            --i;
        } 
    }
    if (m > 1) {
        cout << n << endl;
        return;
    }
    //CNK1 cnk;
    LL ans = 1;
    /*
    REP(i,0,100000) {
        if (ps[i] == 0) continue;
        //dump(i);
        //dump(ps[i]);
        //ans = (ans * (LL)cnk.get(n-1+ps[i], n-1)) % MOD;
        ans = (ans * cnk(n-1+ps[i], n-1)) % MOD;
    }
    */
    for (auto &p: ps) {
        ans = (ans * cnk(n-1+p.second, n-1)) % MOD;
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 256