#include <iostream>
using namespace std;
using ll = long long;
const ll MOD = 1000000007LL;

ll pow(ll a, ll n) {
  ll res = 1;
  for (; n; n >>= 1) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
  }
  return res;
}

ll fact(int n) {
  ll res = 1;
  for (int i = 2; i <= n; i++)
    res = res * i % MOD;
  return res;
}

ll comb(ll n, ll r) {
  ll tmp = 1;
  for (int i = n; i > n - r; i--) tmp = tmp * i % MOD;
  ll inv_fact_r = pow(fact(r), MOD-2);
  return tmp * inv_fact_r % MOD;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, M; cin >> N >> M;
    int m = M;
    ll ans = 1;
    for (int i = 2; i * i <= M; i++) {
        if (m % i) continue;
        ll c = 0;
        while (m % i == 0) {
            c++;
            m /= i;
        }
        ans = ans * comb(c+N-1, c) % MOD;
    }
    if (m > 1) ans = ans * N % MOD;
    cout << ans << "\n";
}