N,M,*as=$<.read.split.map(&:to_i)

as = as.sort_by {|a|-a}
bs = []
m = M
while 0 < m
  if bs.empty? || as[0] > bs[0]
    a = as.shift
    bs << (a>>1)
  else
    b = bs.shift
    bs << (b>>1)
  end
  m -= 1
  if as.empty?
    as = bs
    bs = []
  end
end

ret = (as+bs).inject(&:+)
p ret

