You have N cards with different integers written on them. Takahashi and Aoki play a game where Aoki chooses an integer x, and starting from Takahashi, the players alternately take a card. Takahashi takes the card with the largest integer among the remaining cards, while Aoki takes the card with the integer closest to x among the remaining cards. For each given x, find the sum of the integers on the cards that Takahashi will take. Constraints: 2 ≤ N ≤ 100,000, 1 ≤ Q ≤ 100,000, 1 ≤ A1 < A2 < ... < AN ≤ 10^9, 1 ≤ Xi ≤ 10^9. Input format: N Q A1 AN X1 X2 ... XQ. Output format: Print Q lines, each containing the answer for x = Xi. Example: Input: 5 5 3 5 7 11 13 1 4 9 10 13. Output: 31 31 27 23 23.

# Buggy version:
from itertools import accumulate
import bisect
n,q = map(int,input().split())
if n%2:
  a = [0]+list(map(int,input().split()))
  n += 1
else:
  a = list(map(int,input().split()))
fs = [a[i] if i%2 else 0 for i in range(n)]
accss = [0]*n
accff = list(accumulate(a))
accfs = list(accumulate(fs))
xls = []
xpt = []
print(accff)
print(accfs)
for i in range(n//2):
  xls.append((a[2*i+1]+a[i+n//2])/2)
  if i == 0:
    xpt.append(accff[n-1]-accff[n//2-1])
  else:
    xpt.append(accff[n-1]-accff[i+n//2-1]+accfs[2*i-1])
for _ in range(q):
  x = bisect.bisect_left(xls,int(input()))
  if x >= n-1:
    print(xpt[-1])
  else:
    print(xpt[x])

# Fixed version:
import sys
input = sys.stdin.readline
from itertools import accumulate
import bisect
n,q = map(int,input().split())
if n%2:
  a = [0]+list(map(int,input().split()))
  n += 1
else:
  a = list(map(int,input().split()))
fs = [a[i] if i%2 else 0 for i in range(n)]
accss = [0]*n
accff = list(accumulate(a))
accfs = list(accumulate(fs))
xls = []
xpt = []
for i in range(n//2):
  xls.append((a[2*i+1]+a[i+n//2])/2)
  if i == 0:
    xpt.append(accff[n-1]-accff[n//2-1])
  else:
    xpt.append(accff[n-1]-accff[i+n//2-1]+accfs[2*i-1])
for _ in range(q):
  x = bisect.bisect_left(xls,int(input()))
  if x >= n//2:
    print(xpt[-1])
  else:
    print(xpt[x])

# Buggy version:
# http://kmjp.hatenablog.jp/entry/2019/01/13/0930
import sys
input = sys.stdin.readline

from bisect import bisect_left

n, q = map(int, input().split())
a = list(map(int, input().split()))
xs = [int(input()) for i in range(q)]

# 累積和
s = [0]*(n+1)
se = [0]*(n+1)
for i in range(n):
    s[i+1] = s[i] + a[i]
    if i :
        se[i+1] = se[i-1]
    se[i+1] += a[i]

def check(x, k):
    if k > n:
        return False

    Tk = (k+1)//2
    i = bisect_left(a, x- (a[n-Tk]-x))
    return i+k <= n

for x in xs:
    left = 0
    right = n+1
    while right-left > 1:
        mid = (left+right)//2
        if check(x, mid):
            left = mid
        else:
            right = mid
    top = (left+1)//2
    ans = 0
    ans += s[n] - s[n-top]
    if left%2:
        left += 1
    ans += se[n-left]
    print(ans)

# Fixed version:
# http://kmjp.hatenablog.jp/entry/2019/01/13/0930
import sys
input = sys.stdin.readline

from bisect import bisect_left

n, q = map(int, input().split())
a = list(map(int, input().split()))
xs = [int(input()) for i in range(q)]

s = [0]*(n+1)
se = [0]*(n+1)
for i in range(n):
    s[i+1] = s[i] + a[i]
    if i :
        se[i+1] = se[i-1]
    se[i+1] += a[i]

def check(x, k):
    if k > n:
        return False

    Tk = (k+1)//2
    i = bisect_left(a, x- (a[n-Tk]-x))
    return i+k <= n

for x in xs:
    left = 0
    right = n+1
    while right-left > 1:
        mid = (left+right)//2
        if check(x, mid):
            left = mid
        else:
            right = mid
    top = (left+1)//2
    ans = 0
    ans += s[n] - s[n-top]
    if left%2:
        left += 1
    ans += se[n-left] if n-left>=0 else 0
    print(ans)