import Data.List
import Control.Monad

main :: IO ()
main = print =<< solve . map read . words <$> getLine

solve :: [Integer] -> Integer
solve [n, p] = product . map (\(x, len) -> (x * (len`div`n))) . filter ((>=n) . snd) . pf $ p 

pf :: Integer -> [(Integer, Integer)]
pf n = map (\xs -> (head xs, (fromIntegral.length) xs)) . group $ pf' n (2:[3,5..(truncate.sqrt.fromIntegral $ n)])
  where
   pf' 1 _ = []
   pf' n [] = [n]
   pf' n (x:xs) = if (n `mod` x) == 0
     then x : pf' (n `div` x) (x:xs)
     else pf' n xs