N,P = gets.split(" ").map { |e| e.to_i }

flag = 0
for i in 1..9999 do
  waru = 10000-i
  if P % waru == 0
    if P % waru**N == 0
      puts waru
      flag = 1
      break
    end
  end
end

if flag == 0
  puts 1
end