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

#include <stdio.h>
#include <math.h>
#define N 100001
#define M 1000000007
typedef long long LL;

int n, m, a[33];
LL f[N], invf[N], ans = 0;

LL qpow(LL x, int y)
{
	if(!y) return 1;
	LL t = qpow(x, y >> 1);
	t = t * t % M;
	if(y & 1) t = t * x % M;
	return t;
}

LL C(int x, int y)
{
	return f[x] * invf[y] % M * invf[x - y] % M;
}

void solve(int x, int y, int d)
{
	if(d > n) return;
	a[d] = x;
	int i, k, td = d + 1, j, ta, tn = n, tb;
	LL tp = 1;
	for(i = 1; i <= d; i = j){
		for(j = i + 1, ta = a[i]; j <= d && a[j] == ta; j++);
		tp = tp * C(tn, tb = j - i) % M;
		tn -= tb;
	}
	ans = ans + tp;
	if(ans >= M) ans -= M;
	
	for(i = y, k = sqrt(x); i <= k; i++){
		if(x % i == 0) a[d] = i, solve(x / i, i, td);
	}
}

int main()
{		
	int i, j;
	
	scanf("%d%d", &n, &m);
	if(m == 1 || n == 1){
		puts("1");
		return 0;
	}
	for(f[j = 0] = 1, i = 1; i <= n; j = i++){
		f[i] = f[j] * (LL)i % M;
	}
	invf[j = n] = qpow(f[n], M - 2);
	for(i = j - 1; i >= 0; j = i--){
		invf[i] = invf[j] * (LL)j % M;
	}
	solve(m, 2, 1);
	printf("%lld\n", ans);
			
	return 0;
}