import math

N, P = map(int, input().split())
if N == 1:
    print(P)
    exit()

n = int(math.sqrt(P))
if N >= 4:
    n = int(math.sqrt(n))

for i in range(n)[::-1]:
    if i == 0:
        break
    _num = P
    cnt = 0
    while True:
        if _num % i == 0:
            _num = _num / i
            cnt += 1
        else:
            break
        if cnt == N:
            print(i)
            exit()
print(1)
