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

#define all(x) (x).begin(), (x).end()

const ll MOD = 1000000007;


struct Exp {
    int base, exp;

    Exp(int base, int exp) {
        this->base = base;
        this->exp = exp;
    }

    static ll power_int(ll b, ll e) {
        ll a = 1;
        while (e > 0) {
            if (e & 1) {
                e--; a = a * b % MOD;
            }
            else {
                e /= 2; b = b * b % MOD;
            }
        }
        return a;
    }
};

class Factorial {
    int size;
    vector<ll> facts, inv_facts;

    void init_facts() {
        facts = vector<ll>(size + 1);
        inv_facts = vector<ll>(size + 1);

        facts[0] = 1;
        for (ll i = 1; i <= size; ++i) {
            facts[i] = facts[i - 1] * i % MOD;
        }
        
        inv_facts[size] = Exp::power_int(facts[size], (MOD - 2)) % MOD;
        for (ll i = size - 1; i >= 0; --i) {
            inv_facts[i] = inv_facts[i + 1] * (i + 1) % MOD;
        }
    }

public:
    Factorial(int size) {
        this->size = size;
        init_facts();
    }

    ll fact(int n) {
        return facts[n];
    }

    ll inv_fact(int n) {
        return inv_facts[n];
    }

    ll combination(int n, int r) {
        return fact(n) * inv_fact(r) % MOD * inv_fact(n - r) % MOD;
    }
};

class Prime {
    class Generator23 {
    public:
        int value, step;

        Generator23() {
            this->value = 2;
            this->step = 0;
        }

        int next() {
            if (step) {
                value += step;
                step = 6 - step;
            }
            else {
                switch (value) {
                    case 2: value = 3; break;
                    case 3: value = 5; step = 2; break;
                }
            }
            return value;
        }
    };

public:
    static bool is_prime(int value) {
        auto gcd = [](int n, int m) {
            while (m > 0) {
                int tmp = m;
                m = n % m;
                n = tmp;
            }
            return n;
        };

        if (value <= 3) return value >= 2;
        if (value == 5) return true;
        if (gcd(value, 30) != 1) return false;
        for (int p = 7; p <= (int)sqrt(value); p += 30) {
            if (value % p      || value % (p+4)  ||
                value % (p+6)  || value % (p+10) ||
                value % (p+12) || value % (p+16) ||
                value % (p+22) || value % (p+24))
            {
                return false;
            }
        }
        return true;
    }

    static vector<Exp> prime_division(int value) {
        vector<Exp> pf;
        if (value == 0) return pf;
        if (value < 0) {
            value = -value;
            pf.push_back(Exp(-1, 1));
        }
        Generator23 generator;
        int v = value;
        for (int p = 2; ; p = generator.next()) {
            int count = 0;
            while (1) {
                if (v % p) break;
                v /= p;
                count++;
            }
            if (count != 0) pf.push_back(Exp(p, count));
            if (v <= p) break;
        }
        if (v > 1) pf.push_back(Exp(v, 1));
        return pf;
    }
};

int main() {
    int n, m; cin >> n >> m;
    Factorial f(1000000);
    vector<Exp> ps = Prime::prime_division(m);
    ll ans = accumulate(all(ps), 1LL, [&](ll a, Exp x) {
        return a * f.combination(x.exp + n - 1, x.exp) % MOD;
    });
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 15872