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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define itrdebug(x) cerr << #x << " "; for (auto & el : (x)) {cerr << (el) << " ";} cerr << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define debug(x)
#define itrdebug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

namespace mod {
    long long pow(long long a, long long x, long long p) {
        long long res = 1;
        while(x > 0) {
            if( x % 2 != 0) {
                res = (res * a) % p;
            }
            a = (a * a) % p;
            x /= 2;
        }
        return res;
    }

    long long inverse(long long a, long long p) {
        //calculates the modular multiplicative of a mod m.
        //(assuming p is prime).
        return pow(a, p-2, p);
    }

    long long factorial(long long a, long long p) {
        long long fact = 1;
        for (long long i=2; i<=a; i++) {
            fact *= i;
            fact %= p;
        }
        return fact;
    }

    template <long long MOD>
    struct Int {
        long long x;
        Int(long long x = 0) : x((x % MOD + MOD) % MOD){}
        Int operator-() const { return Int<MOD>(-x);}
        Int& operator+=(const Int<MOD> a) {
            if ((x += a.x) >= MOD) x -= MOD;
            return *this;
        }
        Int& operator-=(const Int<MOD> a) {
            if ((x += MOD-a.x) >= MOD) x -= MOD;
            return *this;
        }
        Int& operator*=(const Int<MOD> a) {
            (x *= a.x) %= MOD; return *this;
        }
        Int operator+(const Int<MOD> a) const { return Int<MOD>(*this) += a;}
        Int operator-(const Int<MOD> a) const { return Int<MOD>(*this) -= a;}
        Int operator*(const Int<MOD> a) const { return Int<MOD>(*this) *= a;}
        Int pow(long long t) const {
            if (!t) return 1;
            Int<MOD> a = pow(t >> 1);
            a *= a;
            if (t&1) a *= *this;
            return a;
        }

        Int inv() const { return pow(MOD - 2);}
        Int& operator/=(const Int<MOD> a) { return *this *= a.inv();}
        Int operator/(const Int<MOD> a) const { return Int<MOD>(*this) /= a;}
    };
}
std::istream& operator>>(std::istream& is, const mod::Int<MOD>& a) { return is >> a.x;}
std::ostream& operator<<(std::ostream& os, const mod::Int<MOD>& a) { return os << a.x;}

class Sieve {
    long long n_;
    vector<long long> sieve_, primes_;

public:
    explicit Sieve(long long n=1): n_(n), sieve_(n + 1) {
        sieve_[0] = sieve_[1] = -1;
        for (long long i = 2; i <= n; ++i) {
            if (sieve_[i]) continue;
            primes_.push_back(i);
            sieve_[i] = i;
            for (long long j = i*i; j <= n; j += i) {
                if (!sieve_[j]) sieve_[j] = i;
            }
        }
    }
    bool isPrime(long long x) {
        assert (n_ * n_ >= x);
        if (n_ >= x) {
            return sieve_[x] == x;
        } else {
            for (const auto prime : primes_) {
                if (x % prime == 0) return false;
            }
            return true;
        }
    }
    vector<long long> getPrimes() {
        return primes_;
    }
    vector<pair<long long, int>> getPrimeFactorList(long long x) {
        assert (n_ * n_ >= x);
        vector<long long> factorList;
        for (int i=(int)primes_.size()-1; i>=0; i--) {
            if (n_ >= x) break;
            while (x % primes_[i] == 0) {
                x /= primes_[i];
                factorList.emplace_back(primes_[i]);
            }
        }
        if (isPrime(x)) {
            factorList.emplace_back(x);
            x /= x;
        }
        assert (n_ >= x);
        while (x != 1) {
            factorList.push_back(sieve_[x]);
            x /= sieve_[x];
        }
        if (factorList.empty()) return {};
        vector<pair<long long, int>> res(1, pair<long long, int>(factorList[0], 0));
        for (long long p : factorList) {
            if (res.back().first == p) {
                res.back().second++;
            } else {
                res.emplace_back(p, 1);
            }
        }
        return res;
    }
};

namespace mod {
    struct Combination {
        Combination(long long max_n, long long p) : _mod(p) {
            factorials_ = std::vector<long long>(max_n+1, 1);
            inverse_factorials_ = std::vector<long long>(max_n+1, 1);
            for (long long i=1; i<max_n+1; i++) {
                factorials_[i] = factorials_[i-1] * i;
                factorials_[i] %= p;
            }
            inverse_factorials_[max_n] = mod::pow(factorials_[max_n],  p-2, p);
            for (long long i=max_n-1; i>=1; i--) {
                inverse_factorials_[i] = inverse_factorials_[i+1] * (i+1);
                inverse_factorials_[i] %= p;
            }
        }

        long long operator()(long long n, long long k) {
            long long result = factorials_[n];
            result *= inverse_factorials_[k];
            result %= _mod;
            result *= inverse_factorials_[n-k];
            result %= _mod;
            return result;
        }

    private:
        std::vector<long long> factorials_, inverse_factorials_;
        long long _mod;
    };
}

long long combination(long long n, long long k) {
    long long numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (int i=0; i<k; i++) {
        numerator = numerator * (n-i);
    }

    long long denominator = 1; // k!
    for (int i=1; i<=k; i++) {
        denominator = denominator * i;
    }

    return numerator / denominator;
}

void solve(long long N, long long M){
    mod::Combination comb(1e6, MOD);
    Sieve sieve(1e6);
    auto factorList = sieve.getPrimeFactorList(M);
    mod::Int<MOD> answer = 1;
    for (const auto& factor : factorList) {
        answer *= comb(N-1+factor.second, N-1);
    }
    cout << answer << endl;
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    solve(N, M);
    return 0;
}


Measured memory_bytes: 24824