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: Accepted)

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Map;
import java.util.Scanner;
import java.util.HashMap;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DFactorization solver = new DFactorization();
        solver.solve(1, in, out);
        out.close();
    }

    static class DFactorization {
        private static final long MOD = (int) 1e9 + 7;
        private static long[] frac;
        private static long[][] npr;
        private static long[] nhr;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 素因数分解 O(log(M)sqrt(N))
            Map<Integer, Integer> facs = new HashMap<>();
            int n = in.nextInt(), m = in.nextInt();
            int p;
            while ((p = getPrimeFactor(m)) > 0) {
                facs.merge(p, 1, (x, y) -> x + y);
                m /= p;
            }
            if (m > 1) {
                facs.merge(m, 1, (x, y) -> x + y);//最大でも2が29個含まれている場合のみ
            }

            // dp - 階乗 O(N + 30)
            frac = new long[n + 30];
            frac[0] = 1;
            for (int i = 1; i < frac.length; i++) {
                frac[i] = (frac[i - 1] * i) % MOD;
            }
            // dp - nPr O(90)
            // 0 <= r <= 30, n <= n' <= n + 30が成立する
            npr = new long[30][30]; // npr[x][y] = (n+y)Px
            Arrays.fill(npr[0], 1);
            for (int i = 0; i < 30; i++) {
                for (int j = 1; j < 30; j++) {
                    npr[j][i] = (npr[j - 1][i] * (n + i - j + 1)) % MOD;
                }
            }
            // dp - nHr O(30)
            nhr = new long[30]; // nhr[r] = nHr
            nhr[0] = 1;
            for (int r = 1; r < 30; r++) {
                nhr[r] = npr[r][r - 1] * pow(frac[r], MOD - 2) % MOD;
            }

            // calc O(log(M))
            long ans = 1;
            for (Integer count : facs.values()) {
                ans *= nhr[count];
                ans %= MOD;
            }

            // output O(1)
            out.println(ans);
        }

        private static int getPrimeFactor(int n) {
            for (int i = 2; i * i <= n; i++) {
                if (n % i == 0) {
                    return i;
                }
            }
            return -1;
        }

        private static long pow(long x, long y) {
            if (y == 0) {
                return 1;
            } else if (y % 2 == 0) {
                long z = pow(x, y / 2);
                return (z * z) % MOD;
            } else {
                return (x % MOD) * pow(x, y - 1) % MOD;
            }
        }

    }
}