def gcd(a, b):
    if a < b:
        a, b = b, a
    r = a % b
    if r == 0:
        return b
    else:
        return gcd(b, r)


def main():
    n, p = map(int, input().split())

    maxi = -1e9

    if p == 1:
        print(1)
        exit()

    if n == 1:
        print(p)
        exit()

    S = set()
    x = int(p ** (1 / n))
    for i in range(x, 1, -1):
        if p % i != 0:
            continue
        else:
            y = p // i
            if y % (n - 1) == 0:
                z = gcd(i, y // (n - 1))
                if z != 1:
                    v = p % (z ** n)
                    #print(z, p)
                    if v == 0:
                        maxi = max(maxi, z)

    if maxi == -1e9:
        print(1)
    else:
        print(maxi)

if __name__ == "__main__":
    main()