output_description: Print Q lines. The i-th line (1 \leq i \leq Q) should contain the answer for x
  = X_i.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N Q
      A_1 A_2 ... A_N
      X_1
      X_2
      :
      X_Q
attempt: import sys
  
  input = sys.stdin.readline
  
  
  def I():
      return int(input())
  
  
  def MI():
      return map(int, input().split())
  
  
  def LI():
      return list(map(int, input().split()))
  
  
  def main():
      mod = 10**9 + 7
      N, Q = MI()
      A = LI()
      if N % 2 == 1:  # 長さが奇数なら0を足しておく
          A += [0]
          N += 1
      A.sort()
  
      """
      連続する区間or交互
      """
  
      S = [0] * (N + 1)
      S2 = [0] * (N + 1)  # 偶数のみ
  
      for i in range(N):
          S[i + 1] = S[i] + A[i]
  
      for i in range(0, N - 1):
          S2[i + 2] = S2[i] + A[i]
  
      # print(S)
      # print(S2)
  
      def calc(P):
          # 先手が上からP枚，後手がその後のP枚をとり，残りを交互に取った時の先手のscore
          fi = S[-1] - S[-P - 1]
          fi += S2[-2 * P]
          return fi
  
      def ch(X, P):
          # xが指定され，先手が上からP枚以上取れるか
          maxa = A[-P - 1]  # 後手が取るmax
          mina = A[
              -2 * P + 1
          ]  # 後手がP-1ターン目までに取る取るmin(後手がPターン目に取るものはなんでも良い)
          diff = A[-P] - X
  
          # print(X,P,mina,maxa,diff)
          if diff < 0:
              return False
          if X - diff <= mina and maxa <= X + diff:
              return True
          return False
  
      for _ in range(Q):
          x = I()
  
          # 先手が上から何枚以上取れるか
          ng = N // 2 + 1
          ok = 1  # 先手が最大値をとる
          while ng - ok > 1:
              med = (ok + ng) // 2
              if ch(x, med):
                  ok = med
              else:
                  ng = med
  
          # print(ok)
          print(calc(ok))
  
  
  main()
  
problem_description: Statement
  
  There are N cards. The i-th card has an integer A_i written on it. For any two
  cards, the integers on those cards are different.
  
  Using these cards, Takahashi and Aoki will play the following game:
  
    * Aoki chooses an integer x.
    * Starting from Takahashi, the two players alternately take a card. The card should be chosen in the following manner:
      * Takahashi should take the card with the largest integer among the remaining card.
      * Aoki should take the card with the integer closest to x among the remaining card. If there are multiple such cards, he should take the card with the smallest integer among those cards.
    * The game ends when there is no card remaining.
  
  You are given Q candidates for the value of x: X_1, X_2, ..., X_Q. For each i
  (1 \leq i \leq Q), find the sum of the integers written on the cards that
  Takahashi will take if Aoki chooses x = X_i.
samples: [{"input": "5 5\n    3 5 7 11 13\n    1\n    4\n    9\n    10\n    13", "output": "31\n    31\n    27\n    23\n    23\n    \n\nFor example, when x = X_3(= 9), the game proceeds as follows:\n\n  * Takahashi takes the card with 13.\n  * Aoki takes the card with 7.\n  * Takahashi takes the card with 11.\n  * Aoki takes the card with 5.\n  * Takahashi takes the card with 3.\n\nThus, 13 + 11 + 3 = 27 should be printed on the third line.\n\n* * *"}, {"input": "4 3\n    10 20 30 40\n    2\n    34\n    34", "output": "70\n    60\n    60"}]