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: from bisect import bisect_left
  import sys
  if sys.version_info[0:2] >= (3, 3):
      from collections.abc import Sequence
  else:
      from collections import Sequence
  
  
  class LazySequence(Sequence):
      def __init__(self, f, n):
          self.f = f
          self.n = n
  
      def __len__(self):
          return self.n
  
      def __getitem__(self, i):
          if not (0 <= i < self.n):
              raise IndexError
          return self.f(i)
  
  
  N, Q = map(int, input().split())
  A = [int(s) for s in input().split()]
  X = []
  for _ in range(Q):
      X.append(int(input()))
  
  A.sort()
  s = [0] * (N + 1)
  for i in range(N + 1):
      s[i] = s[i - 1] + x[i - 1]
  t = [0, A[0]] + [0] * (N - 1)
  for i in range(N):
      t[i] = t[i - 2] + A[i - 1]
  
  
  def index_hidari(x, i):
      val = 2 * x - A[i]
      return bisect_left(A, val)
  
  # x <= A[i]
  
  
  def nankaime(x, i):
      return i - index_hidari(x, i) + 1
  
  
  def npi(x, i):
      return nankaime(x, i) + i
  
  
  def index_migi(x, istart):
      ls = LazySequence(lambda i: npi(x, i + istart), N - istart)
      return istart + bisect_left(ls, N) - 1
  
  
  def getans(x):
      istart = bisect_left(A, x)
      if istart = N:
          return t[N]
      j = index_migi(x, istart)
      turn = N - 1 - i
      i = j - turn
      return t[i - 1] + s[N] - s[j + 1]
  
  
  for i in range(Q):
      print(getans(X[i]))
  
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"}]