#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

long long inv_mod(long long a, long long m) {
  long long b, x, u, q, abs_m, tmp;

  abs_m = (m < 0) ? -m : m;
  b = m;
  x = 1;
  u = 0;
  while (b > 0) {
    q = a / b;
    tmp = u;
    u = x - q * u;
    x = tmp;
    tmp = b;
    b = a - q * b;
    a = tmp;
  }

  return (x < 0) ? abs_m + x : x;
}
template <long long MOD>
struct ModInt{
  long long value;

  ModInt(long long n = 0) {
    if(n >= 0) value = n % MOD;
    else value = (MOD + (n % MOD));
  }

  operator long long() const noexcept {return value % MOD;}

  ModInt<MOD> operator++(int){
    ModInt<MOD> before = *this;
    value = (value + 1) % MOD;
    return before;
  }

  ModInt<MOD> operator--(int){
    ModInt<MOD> before = *this;
    value = (value - 1 + MOD) % MOD;
    return before;
  }

  ModInt<MOD>& operator++(){
    value = (value + 1) % MOD;
    return *this;
  }

  ModInt<MOD>& operator--(){
    value = (value - 1 + MOD) % MOD;
    return *this;
  }

  bool operator!() const noexcept{
    return !static_cast<bool>(value);
  }

  ModInt<MOD> operator+() const{
    return value;
  }
  
  ModInt<MOD> operator-() const{
    return (-value + MOD) % MOD;
  }

  ModInt<MOD>& operator*=(const ModInt<MOD>& m){
    return *this = ModInt<MOD>((this->value * m.value) % MOD);
  }
  ModInt<MOD>& operator+=(const ModInt<MOD>& m){
    return *this = ModInt<MOD>((this->value + m.value) % MOD);
  }
  ModInt<MOD>& operator-=(const ModInt<MOD>& m){
    return *this = ModInt<MOD>((this->value - m.value + MOD) % MOD);
  }
  ModInt<MOD>& operator/=(const ModInt<MOD>& m){
    return *this = ModInt<MOD>((this->value * inv_mod(m.value,MOD)) % MOD);
  }
 };

template<long long MOD>
ModInt<MOD> operator*(const ModInt<MOD>& m1,const ModInt<MOD>& m2){return ModInt<MOD>(m1) *= m2;}
template<long long MOD>
ModInt<MOD> operator+(const ModInt<MOD>& m1,const ModInt<MOD>& m2){return ModInt<MOD>(m1) += m2;}
template<long long MOD>
ModInt<MOD> operator-(const ModInt<MOD>& m1,const ModInt<MOD>& m2){return ModInt<MOD>(m1) -= m2;}
template<long long MOD>
ModInt<MOD> operator/(const ModInt<MOD>& m1,const ModInt<MOD>& m2){return ModInt<MOD>(m1) /= m2;}
template<long long MOD>
ModInt<MOD> operator*(const long long& m1,const ModInt<MOD>& m2){return ModInt<MOD>(m1) *= m2;}
template<long long MOD>
ModInt<MOD> operator+(const long long& m1,const ModInt<MOD>& m2){return ModInt<MOD>(m1) += m2;}
template<long long MOD>
ModInt<MOD> operator-(const long long& m1,const ModInt<MOD>& m2){return ModInt<MOD>(m1) -= m2;}
template<long long MOD>
ModInt<MOD> operator/(const long long& m1,const ModInt<MOD>& m2){return ModInt<MOD>(m1) /= m2;}


template<long long MOD>
struct Fact_Node{
  ModInt<MOD> fact;
  ModInt<MOD> inv_fact;

  ModInt<MOD> operator+() const{
    return fact;
  }
  
  ModInt<MOD> operator-() const{
    return -fact;
  }

  Fact_Node<MOD>& operator*=(const ModInt<MOD>& m){
    fact *= m;
    inv_fact *= m;
    return *this;
  }
  Fact_Node<MOD>& operator/=(const ModInt<MOD>& m){
    fact /= m;
    inv_fact /= m;
    return *this;
  }

  Fact_Node<MOD>& operator*=(const Fact_Node<MOD>& f){
    fact *= f.fact;
    inv_fact *= f.inv_fact;
    return *this;
  }
  Fact_Node<MOD>& operator/=(const Fact_Node<MOD>& f){
    fact *= f.inv_fact;
    inv_fact *= f.fact;
    return *this;
  }
};
template<long long MOD>
Fact_Node<MOD> operator*(const Fact_Node<MOD>& m1,const ModInt<MOD>& m2){return Fact_Node<MOD>(m1) *= m2;}
template<long long MOD>
Fact_Node<MOD> operator/(const Fact_Node<MOD>& m1,const ModInt<MOD>& m2){return Fact_Node<MOD>(m1) /= m2;}
template<long long MOD>
Fact_Node<MOD> operator*(const ModInt<MOD>& m1,const Fact_Node<MOD>& m2){return Fact_Node<MOD>(m2) *= m1;}
template<long long MOD>
Fact_Node<MOD> operator/(const ModInt<MOD>& m1,const Fact_Node<MOD>& m2){return {m1 * m2.inv_fact , m2.fact / m1};}
template<long long MOD>
Fact_Node<MOD> operator*(const Fact_Node<MOD>& m1,const Fact_Node<MOD>& m2){return Fact_Node<MOD>(m1) *= m2;}
template<long long MOD>
Fact_Node<MOD> operator/(const Fact_Node<MOD>& m1,const Fact_Node<MOD>& m2){return Fact_Node<MOD>(m1) /= m2;}

#include <vector>
#include <iostream>
using namespace std;

template<long long MOD>
struct Facts{
  vector<ModInt<MOD>> facts;
  vector<ModInt<MOD>> inv_facts;
  using Node = Fact_Node<MOD>;
  Facts(int N) : facts(N,1) , inv_facts(N){
    for(int i = 1;i < N;i++){
      facts[i] = facts[i - 1] * i;
    }
    inv_facts[N - 1] = 1LL /  facts[N - 1];

    for(int i = N - 1;i >= 1;i--){
      inv_facts[i - 1] = inv_facts[i] * i;
    }
  }

  Node operator[](int n){
    return (Fact_Node<MOD>){facts[n],inv_facts[n]};
  }

  Node nCr(int n,int r){
    return (*this)[n] / (*this)[r] / (*this)[n - r];
  }

  Node nHr(int n,int r){
    return this->nCr(n + r - 1,r);
  }
};
const i64 MOD = 1e9 + 7;
int main(){
  i64 N,M;
  cin >> N >> M;
  Facts<MOD> fact(202020);

  ModInt<MOD> ans = 1;
  for(i64 i = 2;i * i <= M;i++){
    if(M % i == 0){
      i64 cnt = 0;
      while(M % i == 0){
        cnt++;
        M /= i;
      }
      ans *= fact.nHr(N,cnt).fact;
    }
  }

  if(M != 1){
    ans *= fact.nHr(N,1).fact;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3456