import math
q = input().split()
n = int(q[0])
p = int(q[1])
def isprime(n):
    for i in range(int(math.sqrt(n))+1):
        if i == 0 or i == 1:
            continue
        if n % i == 0:
            return False
    return True
a = 1
for i in range(p-2):
    x = i+2
    if p < x**n:
        break
    if isprime(x):
        if p % x**n == 0:
            a *= x
print(a)