def prime(p):

    memo = []

    for i in range(2,(int(p**0.5)+1)):

        while p%i==0:

            p //= i

            memo.append(i)

    if p != 1:

        memo.append(p)

    return memo





import collections



n,p = list(map(int,input().split()))



memo = prime(p)



c = collections.Counter(memo)



score_sorted = sorted(list(c.items()), key=lambda x:-x[0])



if n == 1:

    ans = p

else:

    kake = []

    for i , j in score_sorted:

        if n <= j:

            kake.append(i**(j//n))

    ans = 1

    for i in kake:

        ans *= i



print(ans)
def prime(p):

    memo = []

    for i in range(2,(int(p**0.5)+1)):

        while p%i==0:

            p //= i

            memo.append(i)

    if p != 1:

        memo.append(p)

    return memo



import collections



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



memo = prime(P)



c = collections.Counter(memo)



ans = 1



for key,value in list(c.items()):

    if N <= value:

        ans *= key**(value//N)

print(ans)
def prime(p):
    memo = []
    for i in range(2, (int(p**0.5) + 1)):
        while p % i == 0:
            p //= i
            memo.append(i)
    if p != 1:
        memo.append(p)
    return memo


import collections

n, p = list(map(int, input().split()))
memo = prime(p)
c = collections.Counter(memo)
score_sorted = sorted(list(c.items()), key=lambda x: -x[0])
if n == 1:
    ans = p
else:
    kake = []
    for i, j in score_sorted:
        if n <= j:
            kake.append(i ** (j // n))
    ans = 1
    for i in kake:
        ans *= i
print(ans)

def prime(p):
    memo = []
    for i in range(2, (int(p**0.5) + 1)):
        while p % i == 0:
            p //= i
            memo.append(i)
    if p != 1:
        memo.append(p)
    return memo


import collections

N, P = list(map(int, input().split()))
memo = prime(P)
c = collections.Counter(memo)
ans = 1
for key, value in list(c.items()):
    if N <= value:
        ans *= key ** (value // N)
print(ans)

-n, p = list(map(int, input().split())) -memo = prime(p) +N, P = list(map(int, input().split())) +memo = prime(P) -score_sorted = sorted(list(c.items()), key=lambda x: -x[0]) -if n == 1: -    ans = p -else: -    kake = [] -    for i, j in score_sorted: -        if n <= j: -            kake.append(i ** (j // n)) -    ans = 1 -    for i in kake: -        ans *= i +ans = 1 +for key, value in list(c.items()): +    if N <= value: +        ans *= key ** (value // N)