# class PriorityQueue
# 	def initialize(arr = [])
# 		@nodes = [nil]
# 		arr.each do |a|
# 			 insert(a)
# 		end
# 	end

# 	def front()
# 		return @nodes.size > 1 ? @nodes[1] : nil
# 	end

# 	def insert(node)
# 		if size == 0 then
# 			@nodes.push(node)
# 			return
# 		end

# 		@nodes.push(node)
# 		child = size
# 		parent = getParent(child)
# 		# 親の要素が存在する限りスワップ
# 		while (parent >= 1) && (@nodes[parent] > @nodes[child]) 
# 			swap(parent, child)
# 			child = parent
# 			parent = getParent(child)
# 		end
# 	end

# 	def insertArr(arr)
# 		arr.each do |a|
# 			insert(a)
# 		end
# 	end

# 	def pop()
# 		# ヒープが空
# 		return nil if empty?
# 		# 要素が1つ
# 		return @nodes.pop if size == 1

# 		minval = @nodes[1]
# 		# 最後の要素を先頭に
# 		@nodes[1] = @nodes.pop

# 		# 先頭を下に動かす
# 		parent = 1
# 		child = getSmallChild(parent)
# 		while (child <= size) && (@nodes[child] < @nodes[parent]) 
# 			swap(parent, child)
# 			parent = child
# 			child = getSmallChild(parent)
# 		end
# 		return minval
# 	end

# 	def swap(u, v)
# 		@nodes[u], @nodes[v] = @nodes[v], @nodes[u]
# 	end

# 	def getParent(childNode)
# 		return (childNode / 2).to_i
# 	end

# 	def getSmallChild(parent)
# 		left = parent * 2
# 		right = parent * 2 + 1
# 		# 両方なければsize
# 		# 右がなければ左
# 		# 両方あれば小さい方
# 		if left >= size
# 			return size
# 		elsif right == size
# 			return left
# 		else
# 			return @nodes[left] <= @nodes[right] ? left: right
# 		end
# 	end

# 	def size()
# 		@nodes.size - 1
# 	end

# 	def empty?()
# 		@nodes.size == 1
# 	end

# 	def show()
# 		if empty?
# 			puts "empty!"
# 			return
# 		end
# 		(1..size).each do |i|
# 			puts "#{i} #{@nodes[i]}"
# 		end
# 	end
# end
class PriorityQueue
  def initialize(array = [])
    @data = []
    array.each{|a| push(a)}
  end

  def insert(element)
    @data.push(element)
    bottom_up
  end

  def pop
    if size == 0
      return nil
    elsif size == 1
      return @data.pop
    else
      min = @data[0]
      @data[0] = @data.pop
      top_down
      return min
    end
  end


  def swap(i, j)
    @data[i], @data[j] = @data[j], @data[i]
  end

  def size
    @data.size
  end

  def parent_idx(target_idx)
    (target_idx - (target_idx.even? ? 2 : 1)) / 2
  end

  def bottom_up
    target_idx = size - 1
    return if target_idx == 0
    parent_idx = parent_idx(target_idx)
    while (@data[parent_idx] > @data[target_idx])
      swap(parent_idx, target_idx)
      target_idx = parent_idx
      break if target_idx == 0
      parent_idx = parent_idx(target_idx)
    end
  end

  def top_down
    target_idx = 0

    # child がある場合
    while (has_child?(target_idx))

      a = left_child_idx(target_idx)
      b = right_child_idx(target_idx)

      if @data[b].nil?
        c = a
      else
        c = @data[a] <= @data[b] ? a : b
      end

      if @data[target_idx] > @data[c]
        swap(target_idx, c)
        target_idx = c
      else
        return
      end
    end
  end

  # @param Integer
  # @return Integer
  def left_child_idx(idx)
    (idx * 2) + 1
  end

  # @param Integer
  # @return Integer
  def right_child_idx(idx)
    (idx * 2) + 2
  end

  # @param Integer
  # @return Boolent
  def has_child?(idx)
    ((idx * 2) + 1) < @data.size
  end
end

pp = PriorityQueue.new()

n, m = gets.chomp.split(" ").map(&:to_i)
arr = gets.chomp.split(" ").map{|a| a.to_i * -1}
arr.each do |a|
	pp.insert(a)
end
m.times do |i|
	pp.insert((pp.pop / 2.0).ceil)
end
sum = 0;
pp.size.times do |i|
	sum += pp.pop
end
puts sum.abs



Measured memory_bytes: 13076