n, m = STDIN.gets.split(/\s+/).map(&:to_i)
prices = STDIN.gets.split(/\s+/).map(&:to_i)
log2_prices = prices.map{|x| {price: x, log2_price: Math::log(x,2), ticket_count: 0} }
sum_log2_price = log2_prices.map{|x| x[:log2_price]}.inject(&:+)
near_ceil_price = (sum_log2_price - m)/n

log2_prices.sort_by!{|x| -x[:log2_price] }
remaining_ticket = m
while (remaining_ticket > 0)
   max_price = log2_prices[0]
   if max_price[:log2_price] > near_ceil_price + 1
     using_ticket = (max_price[:log2_price] - near_ceil_price).to_i
   new_price = {price: max_price[:price] / (2 ** using_ticket), log2_price: max_price[:log2_price] - using_ticket, ticket_count:  max_price[:ticket_count] + using_ticket }
   remaining_ticket -= using_ticket
   else
   new_price = {price: max_price[:price] / 2, log2_price: max_price[:log2_price] - 1, ticket_count:  max_price[:ticket_count] + 1 }
   remaining_ticket -= 1
   end
   log2_prices[0] = new_price
   log2_prices.sort_by!{|x| -x[:log2_price] }
end


sum_new_price = log2_prices.map{ |x| x[:price] }.inject(&:+)
puts sum_new_price