#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>

long long int MOD = 1e9+7;

// calculate x%m for x "properly" for all x
long long int mod(long long int x, long long int m);

// calculate inverse of x in mod m
// if there is inverse of x   : return (inverse of x)
// if there is no inverse of x: return 0
long long int mod_inverse(long long int x, long long int m);
// calculate x%m for x "properly" for all x
long long int mod(long long int x, long long int m);

// calculate inverse of x in mod m
// if there is inverse of x   : return (inverse of x)
// if there is no inverse of x: return 0
long long int mod_inverse(long long int x, long long int m);

// calculate inverse of x in mod m for PRIME m
long long int mod_inverse_Fermat(long long int x, long long int m);

// calculate x^n mod m
long long int fast_power(long long int x, long long int n, long long int m);

// subfunctions
long long int euclid_extended(long long int a, long long int b, long long int &x, long long int &y);


int main(){

  long long int N, M;
  scanf("%lld%lld", &N, &M);

  // prime-factorize M
  long long int tmp_factor = 2; 
  long long int tmp_ind = 0;
  long long int tmp_count = 0;
  std::vector<long long int> pf_table;
  while(M>1){
    if(M%tmp_factor == 0){
      tmp_count = 0;
      while(M%tmp_factor == 0){
        tmp_count++;
        M /= tmp_factor;
      }
      pf_table.push_back(tmp_count);
      tmp_ind++;
    }
    tmp_factor++;
  }

  // calculate the prod_i {N+pf_table[i]-1} C {N-1}
  long long int ans = 1;
  long long int tmp1, tmp2, tmp3;
  for(long long int i = 0; i < pf_table.size(); i++){
    tmp1 = 1;
    tmp2 = 1;
    for(long long int j = 1; j <= pf_table[i]; j++){
      tmp1 *= N+pf_table[i]-j;
      tmp2 *= j;
      tmp1 = (tmp1+MOD)%MOD;
      tmp2 = (tmp2+MOD)%MOD;
    }
    tmp3 = tmp1*mod_inverse(tmp2, MOD);
    tmp3 = (tmp3+MOD)%MOD;

    ans *= tmp3;
    ans = (ans+MOD)%MOD;
  }
  
  std::cerr << "Answer: " << std::endl;
  std::cout << ans << std::endl;

  return 0;
}


long long int mod(long long int x, long long int m){
  if(x>0){
    return x%m;
  }
  else if(x==0){
    return 0;
  }
  else if((-x)%m == 0){
    return 0;
  }
  else{
    return m - (-x)%m;
  }
}


long long int euclid_extended(long long int a, long long int b, long long int &x, long long int &y){
  long long int d = a;
  if(b != 0){
    d = euclid_extended(b, a%b, y, x);
    y -= (a/b)*x;
  }
  else{
    x = 1;
    y = 0;
  }
  
  return d;
}

long long int mod_inverse(long long int x, long long int m){
  long long int tmp, x_inv, gcd_xm;
  gcd_xm = euclid_extended(x, m, x_inv, tmp);
  // if the inverse is calculate properly
  if(gcd_xm == 1){
    return mod(x_inv, m);
  }
  else{
    //std::cerr << "Error in mod_inverse: there is no inverse of x in mod m" << std::endl;
    return 0;
  }
}

long long int mod_inverse_Fermat(long long int x, long long int m){
  return fast_power(x, m-2, m);
}

long long int fast_power(long long int x, long long int n, long long int m){
  long long int ans = 1;
  
  while(n > 0){
    if(n&1){
      ans = ans * x;
      ans = mod(ans, m);
    }
    x = x*x;
    x = mod(x, m);
    n = n>>1;
  }
  
  return ans;
}


Measured memory_bytes: 256