fun main(args : Array<String>) {
    val (n, p) = readLine()!!.split(" ").map { it.toLong() }
    val divisors = decom(p)

    var current = p
    var factors = mutableMapOf<Long, Long>()
    divisors.forEach {
        while (current != 1L && current % it == 0L) {
            current /= it
            factors[it] = (factors[it] ?: 0L) + 1L
        }
    }
    factors[current] = 1L

    var ans = 1L
    factors.forEach {
        if (it.value >= n) {
            ans *= Math.pow(it.key.toDouble(), (it.value / n).toDouble()).toLong()
        }
    }

    println(ans)
}

fun prime(from : Long, to : Long = from) : List<Long> {
    return (from..to).filter { i ->
        val max = Math.sqrt(i.toDouble()).toLong()
        (2..max).all { j ->  i % j != 0L }
    }
}

fun decom(value : Long) : List<Long>{
    if (value == 1L) return listOf(1)
    val max = Math.sqrt(value.toDouble()).toLong()
    return prime(2, max).filter { value % it == 0L }
}
