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
  
  read = sys.stdin.buffer.read
  readline = sys.stdin.buffer.readline
  readlines = sys.stdin.buffer.readlines
  
  import numpy as np
  
  N, Q = map(int, readline().split())
  A = np.array(readline().split(), np.int64)
  X = np.array(read().split(), np.int64)
  
  INF = 10**15
  A = np.concatenate([[-INF, -INF, -INF, -INF], A])
  
  """
  ・ある数が後手の右端となるのはどのような場合か
  ・n番目の右側にr>=1個あるとする
  ・【長さが奇数のときは、先頭に0を追加しておく】
    → 後手は、[n-r+1,n]をとって、先手は[n+1:]およびn-rを回収する。
  ・n+1番目をとらない iff r-1個自由にとると n+1番目を含まない iff |A_{n+1}-x| >= |A_{n-r+2}-x|
    iff r = 1 or x <= (A_{n+1}+A_{n-r+2})/2 iff r = 1 or x <= (A_{n+1}+A_{n-r+2})//2
  ・n-r番目をとらない iff r個自由にとると、n-r番目を含まない iff |A_n-x| < |A_{n-r}-x|
    iff x > (A_n+A_{n-r})/2 iff x > (A_n+A_{n-r})//2
  """
  
  n = np.arange(N + 4)
  r = N - n + 3
  ind = (n - r >= 0) & (r >= 1)
  n = n[ind]
  r = r[ind]
  
  lower = (A[n] + A[n - r]) // 2 + 1
  # upper = (A[n+1] + A[n-r+2])//2 不要
  
  # 得点の計算：n+1～の和 + n-rから2つずつ下へ
  
  Acum = np.cumsum(A)
  Acum_ev = np.zeros_like(A)
  Acum_ev[::2] = A[::2].cumsum()
  Acum_ev[1::2] = A[1::2].cumsum()
  score = Acum[-1] - Acum[n] + Acum_ev[n - r] + INF + INF
  
  I = np.searchsorted(lower, X, side="right") - 1
  answer = score[I]
  
  print("\n".join(answer.astype(str)))
  
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"}]