#[allow(unused_imports)]
use std::char::from_digit;
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::fs::File;
#[allow(unused_imports)]
use std::io::prelude::*;
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufReader, BufWriter, Stdin, Stdout, Write};
#[allow(unused_imports)]
use std::mem::swap;
#[allow(unused_imports)]
use std::str::FromStr;

type BoxResult<T> = Result<T, Box<std::error::Error>>;

const MOD: u64 = 1_000_000_000 + 7;

fn main() {
    let mut scanner = Scanner::new(stdin());
    let param = scanner.read_vector::<u64>().unwrap();
    let (n, m) = (param[0], param[1]);
    if n == 1 || m == 1 {
        println!("1");
        return;
    }
    let primes = prime_factorization(m);
    let mut ans = 1;
    for &val in primes.values() {
        ans = (ans * combination(n + val - 1, val, MOD)) % MOD;
    }
    println!("{}", ans);
}

fn combination(n: u64, k: u64, modulo: u64) -> u64 {
    if k == 0 || k == n {
        return 1;
    }
    if n < k {
        return 0;
    }
    let n_fact = (2..(n + 1)).fold(1, |acc, i| (acc * i) % modulo);
    let k_fact = (2..(k + 1)).fold(1, |acc, i| (acc * i) % modulo);
    let nk_fact = (2..(n - k + 1)).fold(1, |acc, i| (acc * i) % modulo);
    let k_fact_inv = power(k_fact, modulo - 2, modulo);
    let nk_fact_inv = power(nk_fact, modulo - 2, modulo);
    let mut ans = n_fact;
    ans = (ans * k_fact_inv) % modulo;
    ans = (ans * nk_fact_inv) % modulo;
    ans
}


fn power(x: u64, mut k: u64, modulo: u64) -> u64 {
    let mut pows = vec![x];
    for i in 0..63 {
        let square = (pows[i] * pows[i]) % modulo;
        pows.push(square);
    }
    let mut pow = 1;
    for i in 0..64 {
        let flag = k & 1;
        k >>= 1;
        if flag == 1 {
            pow = (pow * pows[i]) % modulo;
        }
    }
    pow
}


fn prime_factorization(n: u64) -> HashMap<u64, u64> {
    let mut index = 1;
    let mut primes = HashMap::new();
    while index * index <= n {
        if n % index == 0 {
            let quotient = n / index;
            if is_prime(index) {
                primes.insert(index, calc_log(n, index));
            }
            if quotient != index && is_prime(quotient) {
                primes.insert(quotient, 1);
            }
        }
        index += 1;
    }
    primes
}

fn is_prime(n: u64) -> bool {
    if n == 1 {
        return false;
    }
    let mut cand = 2;
    while cand * cand <= n {
        if n % cand == 0 {
            return false;
        }
        cand += 1;
    }
    true
}

fn calc_log(mut x: u64, y: u64) -> u64 {
    let mut index = 0;
    while x % y == 0 {
        x /= y;
        index += 1;
    }
    index
}

#[allow(dead_code)]
struct Scanner<R> {
    reader: BufReader<R>,
    buffer: String,
}
impl<R> Scanner<R>
where
    R: Read,
{
    #[allow(dead_code)]
    fn new(inner: R) -> Scanner<R> {
        let reader = BufReader::new(inner);
        let buffer = String::new();
        Scanner {
            reader: reader,
            buffer: buffer,
        }
    }
    #[allow(dead_code)]
    fn with_capacity(capacity: usize, inner: R) -> Scanner<R> {
        let reader = BufReader::with_capacity(capacity, inner);
        let buffer = String::new();
        Scanner {
            reader: reader,
            buffer: buffer,
        }
    }

    #[allow(dead_code)]
    fn read_line(&mut self) -> BoxResult<String> {
        self.reader.read_line(&mut self.buffer)?;
        let cloned = self.buffer.trim().to_string();
        self.buffer.clear();
        Ok(cloned)
    }

    #[allow(dead_code)]
    fn read<T>(&mut self) -> BoxResult<T>
    where
        T: FromStr,
        T::Err: std::fmt::Debug,
        T::Err: std::error::Error,
        T::Err: 'static,
    {
        self.reader.read_line(&mut self.buffer)?;
        let parsed = self.buffer.trim().parse()?;
        self.buffer.clear();
        Ok(parsed)
    }
    #[allow(dead_code)]
    fn read_vector<T>(&mut self) -> BoxResult<Vec<T>>
    where
        T: FromStr,
        T::Err: std::fmt::Debug,
        T::Err: std::error::Error,
        T::Err: 'static,
    {
        self.reader.read_line(&mut self.buffer)?;
        let parsed_vec = self
            .buffer
            .trim()
            .split_whitespace()
            .map(|s| s.parse())
            .collect::<Result<Vec<_>, _>>()?;
        self.buffer.clear();
        Ok(parsed_vec)
    }
    #[allow(dead_code)]
    fn read_matrix<T>(&mut self, lines: usize) -> BoxResult<Vec<Vec<T>>>
    where
        T: FromStr,
        T::Err: std::fmt::Debug,
        T::Err: std::error::Error,
        T::Err: 'static,
    {
        let mut parsed_matrix = vec![];
        for _ in 0..lines {
            self.reader.read_line(&mut self.buffer)?;
            parsed_matrix.push(
                self.buffer
                    .trim()
                    .split_whitespace()
                    .map(|s| s.parse())
                    .collect::<Result<Vec<_>, _>>()?,
            );
            self.buffer.clear();
        }
        Ok(parsed_matrix)
    }
    #[allow(dead_code)]
    fn read_chars(&mut self) -> BoxResult<Vec<char>> {
        self.reader.read_line(&mut self.buffer)?;
        let chars = self.buffer.trim().chars().collect::<Vec<_>>();
        self.buffer.clear();
        Ok(chars)
    }
}


Measured memory_bytes: 4352