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: Time Limit Exceeded)

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

vector<ll> primenum;
void get_prime_nembers(ll n)
{
    FOR(i,2,n+1) {
        bool flag = true;
        REPALL(j,primenum) {
            if (i % primenum[j] == 0) {
                flag = false;
                break;
            }
        }
        if (flag)
            primenum.push_back(i);
    }
}

vector<pair<int, int>> prime_factorization(ll n)
{
    if (primenum.empty())
        get_prime_nembers(n);

    vector<pair<int, int>> rtn;
    REPALL(i,primenum) {
        int num = 0;
        ll tmpn = n;
        while(tmpn % primenum[i] == 0) {
            num++;
            tmpn /= primenum[i];
        }
        if (num > 0)
            rtn.push_back(make_pair(primenum[i],num));
    }
    return rtn;
}

vector<vector<ll>> comb(111111, vector<ll>(100, -1));
ll Combination(ll a, ll b)
{
    if (comb[a][b] != -1) {
        return comb[a][b];
    }

    if (b > a / 2) {
        return Combination(a, a - b);
    }

    if (a == b || b == 0) {
        return 1;
    }

    if (comb[a-1][b-1] == -1) {
        comb[a-1][b-1] = Combination(a-1, b-1);
    }

    if (comb[a-1][b] == -1) {
        comb[a-1][b] = Combination(a-1, b);
    }

    comb[a][b] = (comb[a-1][b-1] + comb[a-1][b]) % MOD;

    return comb[a][b];
}

int main()
{
    int n, m;
    cin>>n>>m;
    vector<pair<int, int>> pf(prime_factorization(m));
    ll ans = 1ll;
    REPALL(i,pf) {
        ans *= Combination(n + pf[i].second - 1, pf[i].second);
        ans %= MOD;
    }
    cout<<ans<<endl;
    //REPALL(i,primenum) cout<<primenum[i]<<" ";

    return 0;
}