import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = readLine >>= print . solve 

solve :: [Int] -> Int 
solve [n, p]
    | n == 1 || p == 1 = p
    | otherwise = foldl' ff 1 . filter (\(_, y) -> y >= n) $ pf p
    where
        ff acc (x, y) = acc * (x ^ (y `div` n))

pf :: Int -> [(Int, Int)]
pf p = loop p primes
    where
        loop v (x : xs)
            | v == 1 = []
            | otherwise = (x, y) : loop w xs 
            where
                (w, y) = count v x

        count v x = cloop v 0
            where
                cloop w acc 
                    | w `mod` x == 0 = cloop (w `div` x) (acc + 1)
                    | otherwise = (w, acc)

primes :: [Int]
primes = build [2..]
    where
        build (x : xs) = x : build (filter (\n -> n `mod` x /= 0) xs)

readLine :: IO [Int]
readLine = unfoldr (\s -> second (maybe B.empty snd . B.uncons) <$> B.readInt s) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine