array = gets.split.map(&:to_i)

def factorization (m)
ary = []
  s = Math.sqrt(m.to_f).to_i
for i in(2..s)
  r = 0
  while m%i==0
      m=m/i
      r +=1
    end
    unless r ==0
    ary.push([i,r])
  end
end
if (m>s)
  ary.push([m,1])
end
return ary
end

n= array[0]
p = array[1]

factor_s =factorization(p)
ans = 1
factor_s.each{|fs|
  while fs[1]>=n
    ans *=fs[0]
    fs[1] -=n
  end}
p ans
