import qualified Data.Map.Strict as Map

primeFactorize :: Integer -> [Integer]
primeFactorize 1 = []
primeFactorize x =
    let v = head $ nativeFactors x in
        v : primeFactorize (x `div` v)
    where
        nativeFactors n = [a | a <- [2..n], n `mod` a == 0]

toCountMap :: (Ord k, Integral a) => [k] -> Map.Map k a
toCountMap xs = Map.fromListWith (+) $ zip xs (repeat 1)

main :: IO ()
main = do
    (n:p:_) <- fmap (map read . words) getLine :: IO[Integer]
    print $ solve n p

solve :: Integer -> Integer -> Integer
solve n p =
    let ps = Map.toList $ toCountMap $ primeFactorize p
    in foldr (\ (x, e) total -> total * (x ^ (e `div` n))) 1 ps
        