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# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;



namespace CSharpSample01
{

    
    class Program
    {

        const long MOD = 1000000007;

        //O(√N)
        //Nの素因数をリストで返す
        static List<int> Prime(int N)
        {

            List<int> p = new List<int>();

            for (int i = 2; i <= Math.Sqrt(N); i++)
            {

                while (N % i == 0)
                {
                    p.Add(i);
                    N /= i;
                }

            }

            if (N != 1) p.Add(N);

            return p;
        }

        //コンビネーションの計算
        //(N)C(K)を計算
        static long Conb(int N, int K)
        {
            long[,] c = new long[N + 1, K + 1];

            for (int i = 0; i <= N; i++)
            {
                c[i, 0] = 1;
                if(i <= K) c[i, i] = 1;
            }

            for (int n = 1; n <= N; n++)
            {
                for (int k = 1; k <= K; k++)
                {
                    c[n, k] = c[n - 1, k] + c[n - 1, k - 1];
                    c[n, k] %= MOD;  //64bitを超えないように1000000007で割る
                }
            }

            return c[N, K];
        }

        static void Solve(int N, int M)
        {
            //素因数のリスト(prime_list)
            List<int> prime_list = Prime(M);

            //M = 1の時、1は素数ではないのでprime_listに要素(素数)はない
            //1 * ... * 1 = M と N回 1を掛ける1通り
            if (prime_list.Count == 0)
            {
                Console.WriteLine("1");
                return;
            }

            //Console.WriteLine("prime_list:" + string.Join(" ", prime_list));

            //prime_list内の各素因数の指数を計算(exp)
            List<int> exp = new List<int>();
            int cur = prime_list[0];
            //素因数curの数(指数)をカウント
            int cnt = 0;
            foreach(int val in prime_list)
            {
                if(cur == val)
                {
                    cnt++;
                }
                else
                {
                    exp.Add(cnt);
                    cnt = 1;
                    cur = val;
                }
            }

            exp.Add(cnt);

            //Console.WriteLine("exp:" + string.Join(" ", exp));

            //答えans
            //(exp[i] + N - 1)C(exp[i])を各exp[i]について行う
            long ans = 1;
            for(int i = 0; i < exp.Count; i++)
            {
                ans = (ans * Conb(exp[i] + N - 1, exp[i])) % MOD;                
            }

            Console.WriteLine(ans);
        }

        static void Main(string[] args)
        {
            //入力1(S)
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int M = int.Parse(input[1]);

            Solve(N, M);
        }
    }

}