output_description: Print the minimum amount of money required to buy all the items.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N M
      A_1 A_2 ... A_N
attempt: class Heap:
  
      # 初期化
      def __init__(self):
          self.array = []
  
      def num(self):
          return len(self.array)
  
      # valを追加する
      def put(self, val):
          pos = len(self.array)
          # valを末尾に追加する
          self.array.append(val)
          # valを適当な位置まで上にあげる
          self.pop_up(pos)
  
      # 最大の要素を取り出す
      def get(self):
          assert len(self.array) > 0
  
          val = self.array[0]
  
          # 末尾の要素を0に移動してから下に下げる
          t_val = self.array[-1]
          self.array[0] = t_val
          del self.array[-1]
          self.push_down(0)
          return val
  
      # posの位置の要素を適当な位置まで上げる
      def pop_up(self, pos):
          while pos > 0:
              p_pos = (pos - 1) // 2
              val = self.array[pos]
              p_val = self.array[p_pos]
  
              if val > p_val:
                  self.array[pos] = p_val
                  self.array[p_pos] = val
                  pos = p_pos
              else:
                  break
  
      def push_down(self, pos):
          while True:
              l_pos = 2 * pos + 1
              r_pos = 2 * pos + 2
              n = len(self.array)
  
              if n <= l_pos:
                  # 子がいない場合
                  break
  
              elif n == r_pos:
                  # 子が一人の場合
                  val = self.array[pos]
                  l_val = self.array[l_pos]
  
                  if val < l_val:
                      self.array[pos] = l_val
                      self.array[l_pos] = val
  
                  break  #
  
              else:
                  # 子が二人いるとき
                  val = self.array[pos]
                  l_val = self.array[l_pos]
                  r_val = self.array[r_pos]
  
                  if l_val > r_val:
                      if val < l_val:
                          self.array[pos] = l_val
                          self.array[l_pos] = val
                          pos = l_pos
                      else:
                          break
                  else:
                      if val < r_val:
                          self.array[pos] = r_val
                          self.array[r_pos] = val
                          pos = r_pos
                      else:
                          break
  
  
  h = Heap()
  sn, sm = input().split(" ")
  n = int(sn)
  m = int(sm)
  sa_list = input().split(" ")
  
  
  for sa in sa_list:
      a = int(sa)
      h.put(a)
  
  for i in range(m):
      max_a = h.get()
      h.put(max_a // 2)
  
  
  print(sum(h.array))
  
problem_description: Statement
  
  Takahashi is going to buy N items one by one.
  
  The price of the i-th item he buys is A_i yen (the currency of Japan).
  
  He has M discount tickets, and he can use any number of them when buying an
  item.
  
  If Y tickets are used when buying an item priced X yen, he can get the item
  for \frac{X}{2^Y} (rounded down to the nearest integer) yen.
  
  What is the minimum amount of money required to buy all the items?
samples: [{"input": "3 3\n    2 13 8", "output": "9\n    \n\nWe can buy all the items for 9 yen, as follows:\n\n  * Buy the 1-st item for 2 yen without tickets.\n  * Buy the 2-nd item for 3 yen with 2 tickets.\n  * Buy the 3-rd item for 4 yen with 1 ticket.\n\n* * *"}, {"input": "4 4\n    1 9 3 5", "output": "6\n    \n\n* * *"}, {"input": "1 100000\n    1000000000", "output": "0\n    \n\nWe can buy the item priced 1000000000 yen for 0 yen with 100000 tickets.\n\n* * *"}, {"input": "10 1\n    1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000", "output": "9500000000"}]