multiDiv :: Int -> Int -> (Int, Int)
multiDiv n d = helper n 0
  where helper n' i = if n' `mod` d == 0 
          then helper (n' `div` d) (i + 1)
          else (n', i)

factoring' :: Int -> (Int, [Int])
factoring' n = foldr helper (n, []) $ reverse (2:[3,5..m])
  where m = floor . sqrt $ fromIntegral n
        helper a (n', fs) = let (n'', f) = multiDiv n' a
                             in if f == 0 then (n'', fs)
                                          else (n'', f:fs)

factoring :: Int -> [Int]
factoring n = let (n', fs) = factoring' n
              in if n' == 1 then fs else 1:fs

prime :: Int
prime = 1000000007

mul :: Int -> Int -> Int
mul a b = (a * b) `mod` prime

pow :: Int -> Int -> Int
pow b n
  | n == 1 = b
  | n `mod` 2 == 0 = pow (b `mul` b) (n `div` 2)
  | otherwise = pow b (n - 1) `mul` b

reciprocal :: Int -> Int
reciprocal n = pow n (prime - 2)

com :: Int -> Int -> Int
com n k
  | k == 0 = 1
  | n - k < k = com n (n - k)
  | otherwise = let a = foldr1 mul [n - k + 1 .. n]
                    b = foldr1 mul $ map reciprocal [1..k]
                in a `mul` b

main = do
  [n,m] <- map read . words <$> getLine
  let fs = factoring m
      cs = map (\i -> com (n + i - 1) i) fs
      a = foldr mul 1 cs
  print a
