f =-> {gets.split.map(&:to_i)}
N,M = f[]
A = f[].sort!
c = 0
catch(:x) {
while A[-1] > 0
  1.upto(N) {|i|
    break  if A[-i] < A[-1]/2
    A[-i] /= 2  
    throw :x  if M == c+=1
  }
  A.sort!
end}
p A.inject(:+)