fun pfactorize(n: Long): Map<Long, Int> {
    val primes = mutableMapOf<Long, Int>()
    fun _add(x: Long) {
        val e = primes[x]
        if (e == null) {
            primes[x] = 1
        } else {
            primes[x] = e + 1
        }
    }
    fun _pfactorize(x: Long): Long {
        var p = 2L
        while (p * p <= x) {
            if (x % p == 0L) {
                _add(p)
                return _pfactorize(x / p)
            }
            p++
        }
        return x
    }
    _add(_pfactorize(n))
    return primes
}

fun main(args: Array<String>) {
    val (n, p) = readLine()!!.split(" ").map(String::toLong)
    val primes = pfactorize(p)
    var gcd = 1L
    primes.forEach {
        val f = it.key
        val e = it.value
        gcd *= Math.pow(f.toDouble(), (e / n).toDouble()).toLong()
    }
    println(gcd)
}
