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++14 (GCC 5.4.1) (judge verdict: Accepted)

#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> ppiii;

const int MOD = 1000000007;
ll modpow(ll b, ll e, ll m) {
  ll r = 1;
  while(e) {
    if(e%2) {
      r*=b;
      r%=m;
    }
    b*=b;
    b%=m;
    e/=2;
  }
  return r;
}
ll fact[200000];
ll ifact[200000];

ll choose(int n, int k) {
  assert(k >= 0 && k <= n);
  ll ret = fact[n];
  ret *= ifact[k];
  ret %= MOD;
  ret *= ifact[n-k];
  ret %= MOD;
  return ret;
}

void solve() {
  int n, m;
  cin >> n >> m;
  fact[0] = 1;
  for(int i = 1; i < 200000; i++) {
    fact[i] = i * fact[i-1];
    fact[i] %= MOD;
  }
  ifact[199999] = modpow(fact[199999], MOD-2, MOD);
  for(int i = 199998; i >= 0; i--) {
    ifact[i] = ifact[i+1] * (i+1);
    ifact[i] %= MOD;
  }
  ll ret = 1;
  for(int i = 2; i * i <= m; i++) {
    if(m%i) continue;
    int p = 0;
    while(m%i==0) {
      m /= i;
      p++;
    }
    ret *= choose(n-1+p, n-1);
    ret %= MOD;
  }
  if(m > 1) ret *= choose(n, n-1);
  ret %= MOD;
  cout << ret << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
  solve();
}