Problem:
Score : 400 points

Problem Statement

You are given positive integers N and M.

How many sequences a of length N consisting of positive integers satisfy a_1 \times a_2 \times ... \times a_N = M? Find the count modulo 10^9+7.

Here, two sequences a' and a'' are considered different when there exists some i such that a_i' \neq a_i''.

Constraints

All values in input are integers.

1 \leq N \leq 10^5

1 \leq M \leq 10^9

Input

Input is given from Standard Input in the following format:

N M

Output

Print the number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.

Sample Input 1

2 6

Sample Output 1

4

Four sequences satisfy the condition: \{a_1, a_2\} = \{1, 6\}, \{2, 3\}, \{3, 2\} and \{6, 1\}.

Sample Input 2

3 12

Sample Output 2

18

Sample Input 3

100000 1000000000

Sample Output 3

957870001

Solution in C++ (GCC 9.2.1) (judge verdict: Wrong Answer)

#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007

vector<int> F;
int size;

vector<ll> fact(100100,1),refact(100100,1);

ll modpow(ll n,int r){
  ll res = 1;
  while(r){
    if(r & 1)res = res*n%MOD;
    n = n*n%MOD;
    r >>= 1;
  }
  return res;
}

ll comb(int n,int r){
  ll res = fact[n]*refact[r]%MOD;
  res = res*refact[n-r]%MOD;
  return res;
}
void comb_init(){
  rep(i,100000)fact[i+1] = fact[i]*(i+1)%MOD;
  refact[100000] = modpow(fact[100000],MOD-2);
  for(int i = 100000;i > 0;i--)refact[i-1] = refact[i]*i%MOD;
}
ll res = 0;

void dfs(ll m,ll val,ll rest,int pos,int wa){
  if(rest-wa <= 0 && m > 1)return ;
  if(m == 1){
    val = val*comb(rest,wa)%MOD;
    (res += val)%= MOD;
    return ;
  }
  if(m < F[pos])return ;
  for(int i = pos;i < ::size;i++){
    if(m%F[i] != 0)continue;
    if(i == pos){
      dfs(m/F[i],val,rest,i,wa+1);
    }else{
      dfs(m/F[i],val*comb(rest,wa)%MOD,rest-wa,i,1);
    }
  }
}

int main(){
  
  int n,m;
  cin >> n >> m;
  comb_init();
  for(int i = 2;i*i <= m;i++)if(m%i == 0)F.push_back(i),F.push_back(m/i);  
  F.push_back(m);
  ::size = F.size();
  sort(ALL(F));
  dfs(m,1,n,0,0);
  cout << res << endl;



  return 0;
}