def yakusu_maker(num):
    yakusuu_array=[1]
    for i in range(1,num):
        if num % i == 0:
            yakusuu_array.append(i)
    return(yakusuu_array[-1])

import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)



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

yakusuu_array=[]
yakusuu_array.append(yakusu_maker(P))
a_array=[]
result_array =[]
Pre_num = P
if P==1:
    print(1)
else:
    for i in range(N-1):
            a_array.append(yakusuu_array[-1])
            result_array.append(int(Pre_num/yakusuu_array[-1]))
            Pre_num = yakusuu_array[-1]
            yakusuu_array.append(yakusu_maker(Pre_num))
    result_array.append(a_array[-1])

    print(gcd_list(result_array))