N, P = map(int, input().split())
p = P
import math

MAX = 1000000   # MAX is max number
prime = [True]*(MAX+1)
prime[0] = False
prime[1] = False

R = int(math.sqrt(MAX))

for i in range(2, R+1):
    if prime[i]:
        cnt = 2
        while i * cnt <= MAX:
            prime[i * cnt] = False
            cnt += 1

dp = [0]*(MAX+1)

for i in range(2, MAX+1):
    if prime[i]:
        while P % i == 0:
            dp[i] += 1
            P //= i

ans = 1
for i in range(2, MAX+1):
    if dp[i] >= N:
        ans *= (dp[i] // N) ** i

if N == 1:
    print(p)
else:
    print(ans)
