
// D - Factorization

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;

const int MOD = 1000000007;

vector<pair<ll, ll>> prime_factorize(ll n) {
	vector<pair<ll, ll> > result;
	for (ll p=2; p*p<=n; p++) {
		if (n % p != 0) continue;
		ll num = 0;
		while (n % p == 0) {
			num++;
			n /= p;
		}
		result.push_back(make_pair(p, num));
    }
    if (n != 1) {
    	result.push_back(make_pair(n, 1));
    }
    return result;
}

vector<ll> prime_factorize_straight(ll n) {
	vector<ll> result;
	vector<pair<ll, ll>> pair_result = prime_factorize(n);
	for (auto pair : pair_result) {
		for (ll i=0; i<pair.second; i++) {
			result.push_back(pair.first);
		}
	}

	return result;
}

// mod p （pは素数）の下でのべき乗を求める
ll mod_pow(ll a, ll n, ll p) {
		ll result = 1;
		while (n > 0) {
			if (n & 1) result = result * a % p;
			a = a * a % p;
			n >>= 1;
		}
		return result;
	};

// mod p（pは素数）の下での逆元を求める（フェルマーの小定理を利用）
ll mod_inverse(ll a, ll p) {
	return mod_pow(a, p-2, p);
}

// mod p （pは素数）の下での除算 (a / b)
ll mod_devide(ll a, ll b, ll p) {
	return a * mod_inverse(b, p) % p;
}

ll mod_comb(ll n, ll k, ll p) {
	ll numerator = 1;
	for (int i=n; i>n-k; i--) {
		numerator *= i;
		numerator %= p;
	}

	ll denominator = 1;
	for (int i=k; i>0; i--) {
		denominator *= i;
		denominator %= p;
	}

	return mod_devide(numerator, denominator, p);
}


int main() {
	int N, M;
	cin >> N >> M;

	vector<pair<ll, ll>> pf = prime_factorize(M);

	ll ans = 1;

	for (auto p : pf) {
		int k = p.second;
		ans = (ans * mod_comb(k+N-1, N-1, MOD)) % MOD;
	}

	cout << ans << endl;

	return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, int> Pli;

ll N, M;
const int MAX = 5.0e5 + 100;
const int MOD = 1.0e9 + 7;
ll fac[MAX], finv[MAX], inv[MAX];

vector<ll> primeFactorization(ll n) {
    vector<ll> ret;
    ll a = 2;
    while (n >= a * a) {
        if (n % a == 0) {
            ret.push_back(a);
            n /= a;
        } 
        else a++;
    }
    ret.push_back(n);
    return ret;
}

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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;
    }
}

ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    COMinit();

    cin >> N >> M;

    if (M == 1) {
        cout << 1 << endl;
    }
    else {
        vector<ll> pf = primeFactorization(M);
        map<ll, ll> mp;
        for (int i = 0; i < pf.size(); i++) {
            mp[pf[i]]++;
        }

        ll ans = 1;
        for (auto itr = mp.begin(); itr != mp.end(); itr++) {
            ll val = itr->second;
            ans = (ans * COM(N+val-1, val)) % MOD;
        }

        cout << ans << endl;
    }
    
    return 0;
}