a = gets.chomp.split.map{|aa|aa.to_i}
require 'prime'
b = a[1].prime_division
anan = Array.new(b.size).map{Array.new}
ans = []
for bb in 0...b.size
  b[bb][1].times do
    anan[bb].push(b[bb][0])
  end
end
for bb in 0...anan.size
  if (anan[bb].size / a[0]) >= 1
    ans.push(anan[bb][0])
  end
end
if ans.size == 0
  puts "1"
  exit
end
aaaa = 1
unless a[1] == 1
puts ans.map{|aaa|aaaa = aaaa*aaa}.pop
else
  puts "1"
end