from math import ceil

N, Q = list(map(int, input().split()))

A = [int(a) for a in input().split()]

AltTake = [0 for a in range(N)]

GetAll = [0 for a in range(N)]

AltTake[0], AltTake[1] = A[0], A[1]

GetAll[-1] = A[-1]

BlockList = [0 for i in range(ceil(N/2))]

maxBlock = ceil(N/2)



for i in range(2, N):

    AltTake[i] = A[i] + AltTake[i-2]

for i in reversed(list(range(N-1))):

    GetAll[i] = GetAll[i+1] + A[i]

for i in range(ceil(N/2) - 1):

        BlockList[-i-1] = (A[-i-2] + A[-2*i - 3]) // 2 + 1



def BSearch(x, L):

    left, right = 0, len(L)

    while right - left > 1:

        mid = (right + left)//2

        if L[mid] > x:

            right = mid

        else:

            left = mid

    return left



for _ in range(Q):

    block = maxBlock - BSearch(int(eval(input())), BlockList)

    if block == maxBlock: print((GetAll[-block]))

    else: print((GetAll[-block] + AltTake[N - block * 2 -1]))
import sys

from bisect import bisect_left



def solve():

    input = sys.stdin.readline

    N, Q = map(int, input().split())

    A = [int(a) for a in input().split()]

    X = [int(input()) for _ in range(Q)]

    cont = [0] * N

    cont[N-1] = A[N-1]

    for i in reversed(range(N-1)): cont[i] = cont[i+1] + A[i]

    change = [0] * N

    change[0] = A[0]

    change[1] = A[1]

    for i in range(2, N): change[i] = change[i-2] + A[i]

    upperBound = [-1] * N

    for i in range((N + 1)// 2): #上からi+1個連続でとれるxの最大値

        target = A[N-i-1]

        lower = A[(N-i-1) - i]

        upperBound[N-i-1] = (target + lower) // 2

    upperBound[N-1] = 10 ** 10

    Ans = [0] * Q

    for i, x in enumerate(X):

        pos = bisect_left(upperBound, x)

        Ans[i] += cont[pos] #連続で取れる数

        if N - (N - pos) * 2 - 1 >= 0: Ans[i] += change[N - (N - pos) * 2 - 1]

    print(*Ans, sep="\n")



    return 0



if __name__ == "__main__":

    solve()

from math import ceil

N, Q = list(map(int, input().split()))
A = [int(a) for a in input().split()]
AltTake = [0 for a in range(N)]
GetAll = [0 for a in range(N)]
AltTake[0], AltTake[1] = A[0], A[1]
GetAll[-1] = A[-1]
BlockList = [0 for i in range(ceil(N / 2))]
maxBlock = ceil(N / 2)
for i in range(2, N):
    AltTake[i] = A[i] + AltTake[i - 2]
for i in reversed(list(range(N - 1))):
    GetAll[i] = GetAll[i + 1] + A[i]
for i in range(ceil(N / 2) - 1):
    BlockList[-i - 1] = (A[-i - 2] + A[-2 * i - 3]) // 2 + 1


def BSearch(x, L):
    left, right = 0, len(L)
    while right - left > 1:
        mid = (right + left) // 2
        if L[mid] > x:
            right = mid
        else:
            left = mid
    return left


for _ in range(Q):
    block = maxBlock - BSearch(int(eval(input())), BlockList)
    if block == maxBlock:
        print((GetAll[-block]))
    else:
        print((GetAll[-block] + AltTake[N - block * 2 - 1]))

import sys
from bisect import bisect_left


def solve():
    input = sys.stdin.readline
    N, Q = map(int, input().split())
    A = [int(a) for a in input().split()]
    X = [int(input()) for _ in range(Q)]
    cont = [0] * N
    cont[N - 1] = A[N - 1]
    for i in reversed(range(N - 1)):
        cont[i] = cont[i + 1] + A[i]
    change = [0] * N
    change[0] = A[0]
    change[1] = A[1]
    for i in range(2, N):
        change[i] = change[i - 2] + A[i]
    upperBound = [-1] * N
    for i in range((N + 1) // 2):  # 上からi+1個連続でとれるxの最大値
        target = A[N - i - 1]
        lower = A[(N - i - 1) - i]
        upperBound[N - i - 1] = (target + lower) // 2
    upperBound[N - 1] = 10**10
    Ans = [0] * Q
    for i, x in enumerate(X):
        pos = bisect_left(upperBound, x)
        Ans[i] += cont[pos]  # 連続で取れる数
        if N - (N - pos) * 2 - 1 >= 0:
            Ans[i] += change[N - (N - pos) * 2 - 1]
    print(*Ans, sep="\n")
    return 0


if __name__ == "__main__":
    solve()

-from math import ceil - -N, Q = list(map(int, input().split())) -A = [int(a) for a in input().split()] -AltTake = [0 for a in range(N)] -GetAll = [0 for a in range(N)] -AltTake[0], AltTake[1] = A[0], A[1] -GetAll[-1] = A[-1] -BlockList = [0 for i in range(ceil(N / 2))] -maxBlock = ceil(N / 2) -for i in range(2, N): -    AltTake[i] = A[i] + AltTake[i - 2] -for i in reversed(list(range(N - 1))): -    GetAll[i] = GetAll[i + 1] + A[i] -for i in range(ceil(N / 2) - 1): -    BlockList[-i - 1] = (A[-i - 2] + A[-2 * i - 3]) // 2 + 1 +import sys +from bisect import bisect_left -def BSearch(x, L): -    left, right = 0, len(L) -    while right - left > 1: -        mid = (right + left) // 2 -        if L[mid] > x: -            right = mid -        else: -            left = mid -    return left +def solve(): +    input = sys.stdin.readline +    N, Q = map(int, input().split()) +    A = [int(a) for a in input().split()] +    X = [int(input()) for _ in range(Q)] +    cont = [0] * N +    cont[N - 1] = A[N - 1] +    for i in reversed(range(N - 1)): +        cont[i] = cont[i + 1] + A[i] +    change = [0] * N +    change[0] = A[0] +    change[1] = A[1] +    for i in range(2, N): +        change[i] = change[i - 2] + A[i] +    upperBound = [-1] * N +    for i in range((N + 1) // 2):  # 上からi+1個連続でとれるxの最大値 +        target = A[N - i - 1] +        lower = A[(N - i - 1) - i] +        upperBound[N - i - 1] = (target + lower) // 2 +    upperBound[N - 1] = 10**10 +    Ans = [0] * Q +    for i, x in enumerate(X): +        pos = bisect_left(upperBound, x) +        Ans[i] += cont[pos]  # 連続で取れる数 +        if N - (N - pos) * 2 - 1 >= 0: +            Ans[i] += change[N - (N - pos) * 2 - 1] +    print(*Ans, sep="\n") +    return 0 -for _ in range(Q): -    block = maxBlock - BSearch(int(eval(input())), BlockList) -    if block == maxBlock: -        print((GetAll[-block])) -    else: -        print((GetAll[-block] + AltTake[N - block * 2 - 1])) +if __name__ == "__main__": +    solve()