# coding:utf-8

import sys
from collections import defaultdict

input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7


def inpl(): return list(map(int, input().split()))


N, P = inpl()


def prime_factorization(num):
    prime_cnt = defaultdict(int)

    i = 2
    while i * i <= num:
        if num % i == 0:
            cnt = 0
            while num % i == 0:
                cnt += 1
                num //= i
            prime_cnt[i] += cnt
        i += 1

    if num != 1:
        # nに素数が残っている場合処理をする
        prime_cnt[num] += 1

    return prime_cnt


pcnt = prime_factorization(P)

ans = 1
for key in pcnt.keys():
    if pcnt[key] >= N:
        ans *= key

print(ans)
