n, p = map(int, input().split())
def pf (x,p,a):
    if p * p > x:
        a.append([x,1])
        return a
    c = 0
    while(x % p == 0):
        x = x//p
        c += 1
    if c != 0:
        a.append([p,c])
    return pf(x,p+1,a)
factors = pf(p,2,[])
ret = 1
for prime, exp in factors:
    ret = ret * (prime**(exp//n))
print(ret)