def prime_factorize(n):
    a=[]
    while n%2 ==0:
        a.append(2)
        n //= 2
    f = 3
    while f*f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n!=1:
        a.append(n)
    return a
n,p = map(int,input().split())
keys_l = []
import collections
c=collections.Counter(prime_factorize(p))
#print(c)

ans = 1
for key in c.keys():
    if c[key] >= n:
        ans *= key
print(ans)     