
(defn input []
  (->> (clojure.string/split (read-line) #"\s")
    (map #(bigint %))))

(defn ProductandGCD [[N P]]
  (->> (range 1 (inc P))
    (take-while #(<= (Math/pow % N) P))
    (filter #(zero? (rem P (Math/pow % N))))
    (apply max)))


(->> (input)
  ProductandGCD
  println)