import Debug.Trace

main = do
    [n,p] <- map read . words <$> getLine :: IO [Int]
    let candMax =  ceiling $ (fromIntegral p) ** (1 / (fromIntegral n))
    print $ solve p n candMax

solve :: Int -> Int -> Int -> Int
solve p n i 
    | i == 1 = 1 
    | amari == 0 = i
    | otherwise = solve p n (i-1)
    where 
        temp = i^n
        amari = p `mod` temp