N,M = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)

ans = A.sort.reverse!
tmp = [ans.shift / 2]
(M-1).times do
  if ans.empty?
    ans = tmp
    tmp = [ans.shift / 2]
  elsif ans[0] < tmp[0]
    tmp << tmp.shift / 2
  else
    tmp << ans.shift / 2
  end
end
ans += tmp
puts ans.inject(:+)