#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

constexpr int64_t DIV = 1000000007; // 10^9 + 7

using namespace std;


/** 素因数分解
 */
template<typename T>
std::map<T, size_t>&
factor( T n, const std::vector<T>& primes, std::map<T, size_t>& ret) {
    auto f = primes.begin();
    while (n > 1) {
        while (n % *f == 0) {
            ret[*f] = ret[*f] + 1;
            n /= *f;
        }
        ++f;
    }

    return ret;
}


/* エラトステネスのふるい

   O(n log log n) だいたい線形。 10万とかは余裕
*/
template<typename T>
std::vector<T> sieve(T n)
{
    std::vector<T> primes;
    std::vector<bool> is_prime(n, true);
    is_prime[0] = is_prime[1] = false;

    for (T i = 2; i <= n; ++i) {
        if (is_prime[i]) {
            primes.push_back(i);
            for (T j = 2 * i; j <= n; j += i) {
                is_prime[j] = false;
            }
        }
    }
    return primes;
}

template<typename T>
std::map<T, size_t>
prime_factorize(T n) {
    std::map<T, size_t> res;
    for (T p = 2; p * p <= n; ++p) {
        if (n % p != 0) {
            continue;
        }
        size_t num = 0;
        while (n % p == 0) {
            ++num;
            n /= p;
        }
        res[p] = num;
    }
    if (n != 1) {
        res[n] = 1;
    }
    return res;
}

/** 二項係数計算
    (1 ≦ k ≦ n ≦ 107 程度)
 */
class Combination {
public:
    Combination(int64_t max, int64_t mod) : mod_(mod) {
        fac_.resize(max+1);
        inv_.resize(max+1);
        finv_.resize(max+1);

        fac_[0] = fac_[1] = 1;
        finv_[0] = finv_[1] = 1;
        inv_[1] = 1;
        for (int64_t i = 2; i <= max; 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;
        }
    }

    int64_t get(int64_t n, int64_t k) const {
        if (n < k) {
            return 0;
        }
        if (n < 0 || k < 0) {
            return 0;
        }
        return fac_[n] * (finv_[k] * finv_[n - k] % mod_) % mod_;
    }

    std::vector<int64_t> fac_;
    std::vector<int64_t> finv_;
    std::vector<int64_t> inv_;

    int64_t mod_;
};


int main()
{
    int64_t N, M;
    std::cin >> N >> M;

    //auto P = sieve(int64_t(sqrt(M))+1);
//    std::map<int64_t, size_t> fac;
//    factor(M, P, fac);

    auto fac = prime_factorize(M);

    int64_t ans = 1;
    if (fac.size() > 0) {
        auto a = std::max_element(std::begin(fac), std::end(fac), [](auto l, auto r) {
                return l.second < r.second;
            })->second;
        Combination c(a + N-1 , DIV);

        for (auto f: fac) {
            auto n = f.second;
            ans *= c.get(n + N-1, N-1);
            ans %= DIV;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 2560