import annotation.tailrec
import collection.mutable.{ ListBuffer, HashMap }
import scala.io.StdIn

object Main extends App {

  @tailrec
  def primeFactRec(acc:ListBuffer[Long], num:Long, root:Long):List[Long] = {

    if(root * root > num) (acc += num).toList
    else {
      if(num % root == 0L) primeFactRec((acc += root), num/root, root)
      else primeFactRec(acc, num, root+1L)
    }
  }

  def callPrimeFactRec(n:Long):List[Long] = {

    val ret = ListBuffer.empty[Long]
    primeFactRec(ret, n, 2L)
  }

  val Array(n, p) = StdIn.readLine.split(" ").map(_.toLong)

  val div = callPrimeFactRec(p)
  val ans = {
    val map = HashMap.empty[Long,Long]
    div.foreach(p => {
      if(!map.contains(p)) map += (p -> 1L)
      else map += (p -> (map(p) + 1L))
    })

    map.map(e => math.pow(e._1, e._2/n))
      .filter(_ != 0).product.toInt
  }

  println(ans)
}