N, P = list(map(int, input().split()))


def is_prime(q):
    q = abs(q)
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False
    return pow(2, q - 1, q) == 1


ans = 1
tmp = P

for i in range(2, P):
    if not is_prime(i):
        continue
    while True:
        rest = tmp % (i ** N)
        newtmp = tmp // (i ** N)
        # print(i, tmp, rest, ans)
        if rest == 0:
            ans = ans * i
            tmp = newtmp
        else:
            break
    if newtmp == 0:
        break

print(ans)
