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

template <ll MOD = 1000000007>
struct Mod {
  ll prev = 0;
  vector<ll> fact, inv, finv;
  Mod() {}
  Mod(ll n) { init(n); }

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

  ll inverse(ll a) { return pow(a, MOD - 2); }

  void init(ll n) {
    if (prev >= n) return;
    prev = n;
    fact = inv = finv = vector<ll>(n);

    fact[0] = 1;
    for (ll i = 1; i < n; i++) fact[i] = (fact[i - 1] * i) % MOD;

    inv[1] = 1;
    for (ll i = 2; i < n; i++) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;

    finv[0] = 1;
    for (ll i = 1; i < n; i++) finv[i] = finv[i - 1] * inv[i] % MOD;
  }

  ll comb(ll n, ll k) {
    ll res = 1;
    for (ll i = 0; i < k; i++) {
      res *= (n - i) % MOD;
      res %= MOD;
      res *= inverse(i + 1);
      res %= MOD;
    }
    return res;
  }

  // only for prime MOD
  ll C(ll n, ll k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * finv[k] % MOD * finv[n - k] % MOD;
  }

  ll P(ll n, ll k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * finv[n - k] % MOD;
  }

  ll H(ll n, ll k) {
    if (n < 0 || k < 0) return 0;
    if (!n && !k) return 1;
    return C(n + k - 1, n);
  }

  ll S(ll n, ll k) {
    ll res = 0;
    for (ll i = 1; i <= k; i++) {
      ll tmp = C(k, i) * pow(i, n) % MOD;
      if ((k - i) & 1)
        res += MOD - tmp;
      else
        res += tmp;
      res %= MOD;
    }
    res = res * finv[k] % MOD;
    return res;
  }

  ll B(ll n, ll k) {
    ll res = 0;
    for (ll j = 1; j <= k; j++) {
      res += S(n, j);
      res %= MOD;
    }
    return res;
  }

  vector<vector<ll> > D(ll n, ll m) {
    vector<vector<ll> > dp(n + 1, vector<ll>(m + 1, 0));
    dp[0][0] = 1;
    for (ll i = 0; i <= n; i++) {
      for (ll j = 1; j <= m; j++) {
        if (i - j >= 0)
          dp[i][j] = (dp[i][j - 1] + dp[i - j][j]) % MOD;
        else
          dp[i][j] = dp[i][j - 1];
      }
    }
    return dp;
  }

  ll montmort(ll n) {
    ll res = 0, rinv = 1;
    for (ll k = 2; k <= n; k++) {
      rinv = rinv * inverse(k) % MOD;
      if (k % 2)
        res += MOD - rinv;
      else
        res += rinv;
      res %= MOD;
    }
    for (ll i = 1; i <= n; i++) res = res * i % MOD;
    return res;
  }

  // calculate P(t) from given points in [0,N]
  ll LagrangePolynomial(vector<ll> &y, ll t) {
    ll n = y.size() - 1;
    init(n + 1);
    ll num = 1;
    for (ll i = 0; i <= n; i++) num = num * ((t - i) % MOD) % MOD;
    ll res = 0;
    for (ll i = 0; i <= n; i++) {
      ll tmp = (y[i] * num % MOD) * inverse((t - i) % MOD) % MOD;
      tmp = tmp * finv[i] % MOD;
      tmp = tmp * finv[n - i] % MOD;
      if ((n - i) & 1) tmp = MOD - tmp;
      res = (res + tmp) % MOD;
    }
    return res;
  }
};

template <typename T>
map<T, ll> factorize(T x) {
  map<T, ll> res;
  for (ll i = 2; i * i <= x; i++) {
    while (x % i == 0) {
      x /= i;
      res[i]++;
    }
  }
  if (x != 1) res[x]++;
  return res;
}

int main() {
  ll n, m;
  cin >> n >> m;
  auto x = factorize(m);
  ll ans = 1;

  const ll MOD = 1e9 + 7;
  Mod<MOD> mod(1e6);
  for (auto p : x) {
    ll k = p.second;
    ans *= mod.H(k, n);
    ans %= MOD;
  }

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


Measured memory_bytes: 26732