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 Java8 (OpenJDK 1.8.0) (judge verdict: Wrong Answer)

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
public class Main {

    private int n;
    private int m;
    private Map<Long,Long> primeFactors;
    private final long d = 1000000007;
    
    public static void main(String[] args) {
	Main f = new Main();
	System.out.println(f.solve());
    }

    private Main() {
	set();
    }

    private void set() {
	n = m = 0;
	try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
	    int[] nm = Arrays.stream(br.readLine().trim().split("[\\s]+")).mapToInt(Integer::parseInt).toArray();
	    n = nm[0];
	    m = nm[1];
	} catch(IOException e) {
	    e.printStackTrace();
	}
	primeFactors = new HashMap<>();
	int num = m;
	for (long i=2;i<=num;i++) {
	    long count = 0;
	    while (num%i == 0) {
		count++;
		num /= i;
	    }
	    if (count > 0) primeFactors.put(i,count);
	    if (num == 1) break;
	}
    }

    private long solve() {
	long[] ans = {1};
	primeFactors.forEach((k,v) -> {
		ans[0] = (ans[0]*h(v,n))%d;
	    });
	return ans[0];
    }

    private long h(long a,long b) {
	return c(a+b-1,b);
    }

    private long c(long a,long b) {
	if (a-b < b) b = a-b;
	long u = 1;
	long l = 1;
	for (long i=0;i<=b;i++) {
	    u *= a-i;
	    u %= d;
	    l *= i+1;
	    l %= d;
	}
	return (u*pinv(l,d-2))%d;
    }

    private long pinv(long l,long p) {
	if (p == 0) return 1;
	if (p%2 == 0) {
	    long hp = p/2;
	    long h = pinv(l,hp)%d;
	    return (h*h)%d;
	} else {
	    return (l*pinv(l,p-1))%d;
	}
    }
}