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

if N == 1:

  print(P)

else:

  A, n = [], N

  while n != 0:

    A = [n%2] + A[:]

    n //= 2

  M = int(round(P ** (1/N)))

  g = 1

  for i in range(1, M+1):

    t = 1

    for j in range(len(A)):

      if A[j] == 1:

        t *= i

      if j != len(A) - 1:

        t *= t

    if P % t == 0:

      g = i

  print(g)
def factorization(n):

    a = n

    p = 2

    res = []

    while a != 1:

        cnt = 0

        while a % p == 0:

            cnt += 1

            a //= p

        if cnt:

            res.append([p, cnt])

        p += 1

        if a != 1 and p * p > n:

            res.append([a, 1])

            break

    return res



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

L = factorization(P)

S = 1

for i in L:

    S *= i[0] ** (i[1] // N)

print(S)
N, P = list(map(int, input().split()))
if N == 1:
    print(P)
else:
    A, n = [], N
    while n != 0:
        A = [n % 2] + A[:]
        n //= 2
    M = int(round(P ** (1 / N)))
    g = 1
    for i in range(1, M + 1):
        t = 1
        for j in range(len(A)):
            if A[j] == 1:
                t *= i
            if j != len(A) - 1:
                t *= t
        if P % t == 0:
            g = i
    print(g)

def factorization(n):
    a = n
    p = 2
    res = []
    while a != 1:
        cnt = 0
        while a % p == 0:
            cnt += 1
            a //= p
        if cnt:
            res.append([p, cnt])
        p += 1
        if a != 1 and p * p > n:
            res.append([a, 1])
            break
    return res


N, P = list(map(int, input().split()))
L = factorization(P)
S = 1
for i in L:
    S *= i[0] ** (i[1] // N)
print(S)

+def factorization(n): +    a = n +    p = 2 +    res = [] +    while a != 1: +        cnt = 0 +        while a % p == 0: +            cnt += 1 +            a //= p +        if cnt: +            res.append([p, cnt]) +        p += 1 +        if a != 1 and p * p > n: +            res.append([a, 1]) +            break +    return res + + -if N == 1: -    print(P) -else: -    A, n = [], N -    while n != 0: -        A = [n % 2] + A[:] -        n //= 2 -    M = int(round(P ** (1 / N))) -    g = 1 -    for i in range(1, M + 1): -        t = 1 -        for j in range(len(A)): -            if A[j] == 1: -                t *= i -            if j != len(A) - 1: -                t *= t -        if P % t == 0: -            g = i -    print(g) +L = factorization(P) +S = 1 +for i in L: +    S *= i[0] ** (i[1] // N) +print(S)