import scala.io.StdIn

object Main {

  def main(args: Array[String]): Unit = {

    val Array(n, p) = StdIn.readLine().split(' ').map(_.toLong)
    println(solve(n, p))

  }

  def solve(n: Long, p: Long): Long = {

    if (n == 1) {
      p
    } else {
      val pfactors = factorize(p)
      pfactors.foldLeft((1l, 1, 0l))((acc, pf) =>
        if (acc._3 == pf) {
          if (acc._2 == n - 1) {
            (acc._1 * pf, 1, 0l)
          } else {
            (acc._1, acc._2 + 1, pf)
          }
        } else {
          (acc._1, 1, pf)
        })._1
    }

  }



  def factorize(n: Long): Vector[Long] = {

    def rec(i: Long, q: Long, acc: Vector[Long]): Vector[Long] = {

      if (q <= 1) {
        acc
      } else if (i * i > q) {
        acc :+ q
      } else if (q % i == 0) {
        rec(i, q / i, acc :+ i)
      } else {
        rec(i + 1, q, acc)
      }

    }

    rec(2, n, Vector())

  }

}
