import           Control.Monad
import qualified Data.ByteString.Char8 as BS
import           Data.Maybe

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine


primeFactorization :: Int -> [(Int, Int)]
primeFactorization x = pfact x 2 0 []
  where
    sr = floor $ sqrt $ fromIntegral x
    pfact n i r fs | i > sr    = if n > sr then (n,1):fs else fs
                   | otherwise =
                     if n `mod` i == 0
                     then pfact (n `div` i) i (r+1) fs
                     else pfact n (i+1) 0 (if r > 0 then (i,r):fs else fs)

main = do
  [n, p] <- getIntList

  let fs = primeFactorization p
      ans = product $ map (\(i,r) -> i ^ (r `div` n)) fs

  print ans