def main():

    N, P = (int(i) for i in input().split())



    def trial_division(n):

        divs = []

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

            if n % i == 0:

                divs.append(i)

                if i != n//i:

                    divs.append(n//i)

        return divs

    divs = trial_division(P)

    divs.sort()

    ans = 1

    for d in divs[1:]:

        # print(d, d**N, d**N <= P, P / d**N)

        # print(d)

        cur = 1

        for i in range(N):

            cur *= d

            if P < cur:

                break

        if P < cur:

            break

        if P % (d**N) == 0:

            ans = d

    print(ans)





if __name__ == '__main__':

    main()

def main():

    N, P = (int(i) for i in input().split())



    def enum_divisors(n):

        # 約数列挙

        divs = []

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

            if i*i > n:

                break

            if n % i == 0:

                divs.append(i)

                if n//i != i:

                    # i が平方数でない

                    divs.append(n//i)

        return divs



    divs = enum_divisors(P)

    divs.sort()

    ans = 1

    for d in divs[-1:0:-1]:

        v = 1

        for _ in range(N):

            v *= d

            if v > P:

                break

        else:

            if P % v == 0:

                ans = d

                break

    print(ans)





if __name__ == '__main__':

    main()

def main():
    N, P = (int(i) for i in input().split())

    def trial_division(n):
        divs = []
        for i in range(1, int(n**0.5) + 1):
            if n % i == 0:
                divs.append(i)
                if i != n // i:
                    divs.append(n // i)
        return divs

    divs = trial_division(P)
    divs.sort()
    ans = 1
    for d in divs[1:]:
        # print(d, d**N, d**N <= P, P / d**N)
        # print(d)
        cur = 1
        for i in range(N):
            cur *= d
            if P < cur:
                break
        if P < cur:
            break
        if P % (d**N) == 0:
            ans = d
    print(ans)


if __name__ == "__main__":
    main()

def main():
    N, P = (int(i) for i in input().split())

    def enum_divisors(n):
        # 約数列挙
        divs = []
        for i in range(1, n + 1):
            if i * i > n:
                break
            if n % i == 0:
                divs.append(i)
                if n // i != i:
                    # i が平方数でない
                    divs.append(n // i)
        return divs

    divs = enum_divisors(P)
    divs.sort()
    ans = 1
    for d in divs[-1:0:-1]:
        v = 1
        for _ in range(N):
            v *= d
            if v > P:
                break
        else:
            if P % v == 0:
                ans = d
                break
    print(ans)


if __name__ == "__main__":
    main()

-    def trial_division(n): +    def enum_divisors(n): +        # 約数列挙 -        for i in range(1, int(n**0.5) + 1): +        for i in range(1, n + 1): +            if i * i > n: +                break -                if i != n // i: +                if n // i != i: +                    # i が平方数でない -    divs = trial_division(P) +    divs = enum_divisors(P) -    for d in divs[1:]: -        # print(d, d**N, d**N <= P, P / d**N) -        # print(d) -        cur = 1 -        for i in range(N): -            cur *= d -            if P < cur: +    for d in divs[-1:0:-1]: +        v = 1 +        for _ in range(N): +            v *= d +            if v > P: -        if P < cur: -            break -        if P % (d**N) == 0: -            ans = d +        else: +            if P % v == 0: +                ans = d +                break