main = do
  [n, p] <- fmap (map read . words) getLine
  let (ni, pi) = (floor n, floor p)
  let x = floor $ p ** (1.0 / n)
  --print $ (head . dropWhile (\d -> 0 /= mod (floor p) (product (replicate (floor n) d)))) (reverse [1..x])
  print $ (head . dropWhile (\d -> 0 /= mod pi (iexp d ni))) (reverse [1..x])

iexp x n = (product . replicate n) x
