n, k = gets.chomp.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i)
aa = a.inject(:+)
l = []
ll = []
i = 1
while i <= (aa ** 0.5).floor
  if aa % i == 0
    l << aa / i
    ll << i
  end
  i += 1
end
if l[-1] == ll[0]
  ll.delete_at(0)
end
l += ll.reverse
puts l[0]

#l.each do |i|
  
#end

