def max(a,b); a > b ? a : b; end

class PQ
  attr_reader :arr

  def initialize(arr)
    @arr = arr.sort!.reverse!
  end

  def at(i); @arr[i-1]; end
  def at=(i,v); @arr[i-1]=v; end
  def swap(i,j); @arr[i-1], @arr[j-1] = @arr[j-1], @arr[i-1]; end
  def swapif(i,j);swap(i,j) if at(j) > at(i); end
  def size; @arr.size; end

  def enq(v)
    @arr << v
    i = size
    until i == 1 || at(i/2) >= at(i)
      swap(i,i/2)
      i /= 2
    end
  end

  def deq
    swap(1,size)
    v = @arr.pop
    i = 1
    until i * 2 > size
      j,k = i*2,i*2+1
      if at(k).nil? || at(j) >= at(k) then swapif(i,j) else swapif(i,k) end
      i *= 2
    end
    v
  end
end

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

Q = PQ.new(A)
M.times do
    v = Q.deq
    Q.enq(v/2)
end

puts Q.arr.inject(:+)
