import scala.io.Source

  def solve(n: Int, p: Long): Long = {
    def primeFactors(x: Long): Seq[Long] = {
      def go(x0: Long, y: Long, zs: Seq[Long]): Seq[Long] =
        x0 match {
          case 1 => zs
          case x0 if x0 % y == 0 => go(x0 / y, y, y +: zs)
          case x0 => go(x0, y + 1, zs)
        }

      go(p, 2L, Nil)
    }

    def factorGroups(factors: Seq[Long]): Seq[Exp] = {
      def go(xs: Seq[Long], count: Long, ys: Seq[Exp]): Seq[Exp] =
        xs match {
          case x0 +: x1 +: rest if x0 == x1 => go(x1 +: rest, count + 1, ys)
          case x0 +: x1 +: rest => go(x1 +: rest, 0, Exp(x0, count + 1) +: ys)
          case x +: Nil => Exp(x, count + 1) +: ys
          case Nil => ys
        }

      go(factors, 0, Nil)
    }

    val factors = primeFactors(p)
    val groups = factorGroups(factors)

    groups.map(f => Exp(f.base, f.degree / n)).map(_.toLong).foldLeft(1L)(_ * _)
  }

  case class Exp(base: Long, degree: Long) {
    def toLong: Long = Math.pow(base, degree).toLong
  }

    val (n, p) =
      Source.stdin.getLines.toSeq.head.split(" ").toSeq match {
        case n +: p +: Nil => (n.toInt, p.toLong)
      }
    val ans = solve(n, p)
    println(ans)
