#![allow(unused_imports)] use std::cmp::*; use std::collections::*; use std::io::Write; use std::ops::Bound::*; #[allow(unused_macros)] macro_rules! debug { ($($e:expr),*) => { #[cfg(debug_assertions)] $({ let (e, mut err) = (stringify!($e), std::io::stderr()); writeln!(err, "{} = {:?}", e, $e).unwrap() })* }; } fn main() { let v = read_vec::(); let (n, k) = (v[0], v[1]); let primes = get_primes(1000000); let factor_counts = factorize(n, &primes).values().cloned().collect::>(); let mut ans = Modulo(1); for count in factor_counts { let mut temp = Modulo(1); for i in 0..count { temp *= Modulo::new(k + count - i); temp *= Modulo(i + 1).inv(); } ans *= temp; } println!("{}", ans); } fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec() -> Vec { read::() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() } #[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] struct Modulo(i64); static mut MODULUS: i64 = 1000_000_000 + 7; impl Modulo { fn set_modulus(m: i64) { unsafe { MODULUS = m; } } fn get_modulus() -> i64 { unsafe { MODULUS } } fn new(x: i64) -> Modulo { let m = Modulo::get_modulus(); if x < 0 { Modulo(x % m + m) } else if x < m { Modulo(x) } else { Modulo(x % m) } } fn pow(self, p: i64) -> Modulo { if p == 0 { Modulo(1) } else { let mut t = self.pow(p / 2); t *= t; if p & 1 == 1 { t *= self; } t } } fn inv(self) -> Modulo { self.pow(Modulo::get_modulus() - 2) } } impl std::fmt::Display for Modulo { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { self.0.fmt(f) } } impl std::ops::AddAssign for Modulo { fn add_assign(&mut self, other: Modulo) { let m = Modulo::get_modulus(); self.0 += other.0; if self.0 >= m { self.0 -= m; } } } impl std::ops::MulAssign for Modulo { fn mul_assign(&mut self, other: Modulo) { let m = Modulo::get_modulus(); self.0 *= other.0; self.0 %= m; } } impl std::ops::SubAssign for Modulo { fn sub_assign(&mut self, other: Modulo) { let m = Modulo::get_modulus(); self.0 += m - other.0; if self.0 >= m { self.0 -= m; } } } macro_rules! impl_modulo_ops { ($imp:ident, $method:ident, $assign_imp:ident, $assign_method:ident) => { impl<'a> std::ops::$assign_imp<&'a Modulo> for Modulo { fn $assign_method(&mut self, other: &'a Modulo) { std::ops::$assign_imp::$assign_method(self, *other); } } impl std::ops::$imp for Modulo { type Output = Modulo; fn $method(self, other: Modulo) -> Modulo { let mut x = self; std::ops::$assign_imp::$assign_method(&mut x, other); x } } impl<'a> std::ops::$imp for &'a Modulo { type Output = Modulo; fn $method(self, other: Modulo) -> Modulo { std::ops::$imp::$method(*self, other) } } impl<'a> std::ops::$imp<&'a Modulo> for Modulo { type Output = Modulo; fn $method(self, other: &'a Modulo) -> Modulo { std::ops::$imp::$method(self, *other) } } impl<'a, 'b> std::ops::$imp<&'b Modulo> for &'a Modulo { type Output = Modulo; fn $method(self, other: &'b Modulo) -> Modulo { std::ops::$imp::$method(*self, *other) } } impl std::ops::$assign_imp for Modulo { fn $assign_method(&mut self, other: i64) { std::ops::$assign_imp::$assign_method(self, Modulo::new(other)); } } impl<'a> std::ops::$assign_imp<&'a i64> for Modulo { fn $assign_method(&mut self, other: &'a i64) { std::ops::$assign_imp::$assign_method(self, *other); } } impl std::ops::$imp for Modulo { type Output = Modulo; fn $method(self, other: i64) -> Modulo { let mut x = self; std::ops::$assign_imp::$assign_method(&mut x, other); x } } impl<'a> std::ops::$imp<&'a i64> for Modulo { type Output = Modulo; fn $method(self, other: &'a i64) -> Modulo { std::ops::$imp::$method(self, *other) } } impl<'a> std::ops::$imp for &'a Modulo { type Output = Modulo; fn $method(self, other: i64) -> Modulo { std::ops::$imp::$method(*self, other) } } impl<'a, 'b> std::ops::$imp<&'b i64> for &'a Modulo { type Output = Modulo; fn $method(self, other: &'b i64) -> Modulo { std::ops::$imp::$method(*self, *other) } } }; } impl_modulo_ops!(Add, add, AddAssign, add_assign); impl_modulo_ops!(Mul, mul, MulAssign, mul_assign); impl_modulo_ops!(Sub, sub, SubAssign, sub_assign); use std::iter::Sum; impl Sum for Modulo { fn sum(iter: I) -> Self where I: Iterator, { iter.fold(Modulo(0), |a, b| a + b) } } impl<'a> Sum<&'a Modulo> for Modulo { fn sum(iter: I) -> Self where I: Iterator, { iter.fold(Modulo(0), |a, b| a + b) } } use std::iter::Product; impl Product for Modulo { fn product(iter: I) -> Self where I: Iterator, { iter.fold(Modulo(1), |a, b| a * b) } } impl<'a> Product<&'a Modulo> for Modulo { fn product(iter: I) -> Self where I: Iterator, { iter.fold(Modulo(1), |a, b| a * b) } } fn mod_comb(n: usize, k: usize, fact: &[Modulo], fact_inv: &[Modulo]) -> Modulo { assert!(n >= k); fact[n] * fact_inv[n - k] * fact_inv[k] } fn factorize(mut num: i64, primes: &Vec) -> std::collections::HashMap { // max_primes >= (num)^(1/2) let num_org = num; let mut dict = std::collections::HashMap::new(); for &p in primes.iter() { while num % p == 0 { *dict.entry(p).or_insert(0) += 1; num /= p; } if num == 1 { break; } if p * p > num_org { *dict.entry(num).or_insert(0) += 1; break; } } if num != 1 { dict.insert(num, 1); } dict } fn get_primes(n: i64) -> Vec { let mut is_prime = vec![true; n as usize + 1]; let mut primes = Vec::new(); is_prime[0] = false; is_prime[1] = false; for i in 2..n + 1 { if is_prime[i as usize] { primes.push(i); let mut j = 2 * i; while j <= n { is_prime[j as usize] = false; j += i; } } } primes }