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 Kotlin (1.0.0) (judge verdict: Wrong Answer)

fun main(args : Array<String>) {
    val (N, M) = readLine()!!.split(" ").map { it.toLong() }
    val fact = primeFactor(M.toInt())
    val MOD = 1000000000+7L
    if (fact.entries.size == 0) {
        println(0)
        return
    }
    var ans = 1L
    fact.entries.forEach {
        // N 個
        ans = ans * nCk(it.value + (N-1), N-1, MOD) % MOD
    }
    println(ans)
}


// O(N^0.5)
// O(√n)
fun primeFactor(n: Int) : Map<Int, Int> {
    val map = mutableMapOf<Int, Int>()
    var num = n;
    for (i in 2..(Math.sqrt(n.toDouble())).toInt()) {
        // iで割れるところまで割り続ける
        while (num % i == 0) {
            if (map[i] == null) {
                map[i] = 1
            } else {
                map[i] = 1 + map[i]!!
            }
            num /= i;
        }
    }
    // 残りが1じゃなかったらそれもカウントする
    if (num != 1) map[num] = 1

    return map
}
/*
fun primeFactor(N: Long) : Map<Long, Long> {
    val map = hashMapOf<Long, Long>();
    var num = N
    (2..(Math.sqrt(N.toDouble()).toLong())).forEach {
        var count = 0L
        while (num % it == 0L) {
            num /= it
            count++
        }
        map[it] = count
    }

    if (num != 1L) {
        map[num] = 1
    }

    return map
}
*/

fun pow(a: Long, b: Long, M: Long): Long {
    var b = b
    var ret: Long = 1
    var tmp = a
    while (b > 0) {
        if (b and 1 == 1L) ret = ret * tmp % M
        tmp = tmp * tmp % M
        b = b shr 1
    }
    return ret
}
fun nCk(n: Long, k: Long, M: Long): Long {
    var ret: Long = 1
    val min = Math.min(k, n - k)
    for (i in 1..min) {
        ret = ret * pow(i, (M - 2), M) % M
    }
    for (i in n - min + 1..n) {
        ret = ret * i % M
    }
    return ret
}