N,k,*A = $<.read.split.map &:to_i
A.sort!
p A
while k>0
  x = (A[-1]+1) >> 1
  (A.size-1).downto(0) {|i|
    a = A[i]
    break  if a < x
    A.push << (a - A[i]=(a>>1))
    p [k,A]
    break  if 0 == k-=1
  }
  A.sort!
p A
end
p A.sort!
p A.max