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

#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

pub fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);
parse_tuple!(A, B, C, D);
parse_tuple!(A, B, C, D, E);

// ===


fn generate_primes(upto: usize) -> Vec<usize> {
    let mut is_prime = vec![true; upto];
    let mut primes = vec![];
    is_prime[0] = false;
    is_prime[1] = false;
    for i in 2..upto {
        if is_prime[i] {
            primes.push(i);
            let mut j = i*2;
            while j < upto {
                is_prime[j] = false;
                j += i;
            }
        }
    }
    primes
}

const MOD: u64 = 1000000007;

struct Combination {
    fact: Vec<u64>,
    invfact: Vec<u64>
}

impl Combination {
    fn inv(a: u64) -> u64 {
        Combination::pow(a, MOD-2)
    }

    fn pow(a: u64, p: u64) -> u64 {
        let mut p = p;
        let mut aa = a;
        let mut ret = 1;
        while p >= 1 {
            if p & 1 == 1 {
                ret *= aa;
                ret %= MOD;
            }
            p >>= 1;
            aa = aa * aa % MOD;
        }
        ret
    }

    fn new(upto: usize) -> Self {
        let mut fact = vec![0; upto];
        let mut invfact = vec![0; upto];

        fact[0] = 1;
        for i in 1..upto {
            fact[i] = fact[i-1] * (i as u64) % MOD;
        }

        invfact[upto-1] = Combination::inv(fact[upto-1]);
        invfact[0] = 1;
        for i in (1..upto-1).rev() {
            invfact[i] = invfact[i+1] * ((i+1) as u64) % MOD;
        }

        Combination { fact: fact, invfact: invfact }
    }

    fn comb(&self, n: usize, r: usize) -> u64 {
        if r < 0 || r > n {
            return 0;
        }
        self.fact[n] * self.invfact[r] % MOD * self.invfact[n-r] % MOD
    }
}

fn main() {
    let (n, m): (usize, usize) = read();
    let p: Vec<usize> = generate_primes(100000);

    let mut m = m;
    let mut degs = vec![];
    for pi in p {
        let mut count = 0;
        while m % pi == 0 {
            m /= pi;
            count += 1;
        }
        if count >= 1 {
            degs.push(count);
        }
    }
    if m != 1 {
        degs.push(1);
    }
    // println!("{:?}", degs);

    let comb = Combination::new(200010);
    let mut ans = 1;
    for d in degs {
        ans *= comb.comb(d+n-1, n-1);
        ans %= MOD;
    }
    println!("{}", ans);
}