require "prime"
n,k = gets.chomp.split.collect{ |item| item.to_i}
alist = gets.chomp.split.collect{ |item| item.to_i}
max = alist.inject(:+)
gcd = max.prime_division
alist.sort!
ald = true
if k >= (max - alist.max)
  puts max
  ald = false
end

def check(num,list,maxk)
  cost = 0
  list.each do |li|
    cost += li%num
  end
  if maxk >= cost/2
    return true
  else
    return false
  end
end

clist = []
gcd.each do |set|
  set[1].times { clist << set[0]}
end
result = 1
if ald
  testlist = []
  1.upto(clist.size) do |nn|
    clist.combination(nn).each do |testset|
      test = testset.inject(:*)
      testlist << test if test != max
    end
  end
  testlist.sort.each do |test|
    if check(test,alist,k)
      result = test
    end
  end
  puts result
end
