N,P = map(int,input().split(" "))
gcd = 1
flag = 0
for i in range(P):
    g = i+2
    conp = P
    for j in range(N):
        if conp%g!=0:
            break
        else:
            conp = int(conp/g)
    if j+1 == N:
        gcd = g
print(gcd)