import bisect



n,q = list(map(int,input().split()))

A = list(map(int,input().split()))



dic = {}



w = [A[0]]

for i in range(1,n):

    w.append(w[-1]+A[i])

w1 = [A[0],0]

w2 = [0,A[1]]

for i in range(2,n):

    if i%2 == 0:

        w1.append(w1[-2]+A[i])

        w2.append(0)

    else:

        w2.append(w2[-2]+A[i])

        w1.append(0)



def solve(x):

    if x in dic:

        print((dic[x]))

        return 

    if x >= A[-1]:

        count = max(w1[-1],w2[-1])

        dic[x] = count

        print(count)

        return

    l = 0

    r = 10**10

    while r > l+1:

        m = (r+l)//2

        li = bisect.bisect_left(A,x-m)

        ri = bisect.bisect_right(A,x+m)

        if n-ri == ri-li:

            count = w[-1]-w[ri-1]

            li -= 1

            if li>= 0:

                if li%2 == 0:

                    count += w1[li]

                else:

                    count += w2[li]

            dic[x] = count

            print(count)

            return 0

        if n-ri == ri-li+1:

            count = w[-1]-w[ri-1]

            li -= 2

            if li>= 0:

                if li%2 == 0:

                    count += w1[li]

                else:

                    count += w2[li]

            dic[x] = count

            print(count)

            return 0

        if A[ri-1] == x+m:

            ri2 = ri-1

            if n-ri2 == ri2-li:

                count = w[-1]-w[ri2-1]

                li -= 1

                if li>= 0:

                    if li%2 == 0:

                        count += w1[li]

                    else:

                        count += w2[li]

                dic[x] = count

                print(count)

                return 0

            elif n-ri2 == ri2-li+1:

                count = w[-1]-w[ri2-1]

                li -= 2

                if li>= 0:

                    if li%2 == 0:

                        count += w1[li]

                    else:

                        count += w2[li]

                dic[x] = count

                print(count)

                return 0

        if 2*ri > n+li:

            r = m

        else:

            l = m

    

    count = max(w1[-1],w2[-1])

    dic[x] = count

    print(count)

    return



for _ in range(q):

    x = int(eval(input()))

    solve(x)



n,q = list(map(int,input().split()))



A = list(map(int,input().split()))



w = [A[0]]

for i in range(1,n):

    w.append(w[-1]+A[i])



w1 = [0]*n

for i in range(n):

    if (n-1-i)%2 == 0:

        w1[i] = A[i]

    if i > 0:

        w1[i] += w1[i-1]



def solve(x):

    l = 0

    r = n+1

    while r-l > 1:

        m = (r+l)//2

        if A[n-m] <= x:

            r = m

        else:

            if 2*m-1 > n:

                r = m

            else:

                if A[n-m]-x >= x-A[n-2*m+1]:

                    l = m

                else:

                    r = m

    ans = w[-1]-w[n-l-1]

    if n-2*l-1 >= 0:

        ans += w1[n-2*l-1]

    print(ans)



for _ in range(q):

    solve(int(eval(input())))
import bisect

n, q = list(map(int, input().split()))
A = list(map(int, input().split()))
dic = {}
w = [A[0]]
for i in range(1, n):
    w.append(w[-1] + A[i])
w1 = [A[0], 0]
w2 = [0, A[1]]
for i in range(2, n):
    if i % 2 == 0:
        w1.append(w1[-2] + A[i])
        w2.append(0)
    else:
        w2.append(w2[-2] + A[i])
        w1.append(0)


def solve(x):
    if x in dic:
        print((dic[x]))
        return
    if x >= A[-1]:
        count = max(w1[-1], w2[-1])
        dic[x] = count
        print(count)
        return
    l = 0
    r = 10**10
    while r > l + 1:
        m = (r + l) // 2
        li = bisect.bisect_left(A, x - m)
        ri = bisect.bisect_right(A, x + m)
        if n - ri == ri - li:
            count = w[-1] - w[ri - 1]
            li -= 1
            if li >= 0:
                if li % 2 == 0:
                    count += w1[li]
                else:
                    count += w2[li]
            dic[x] = count
            print(count)
            return 0
        if n - ri == ri - li + 1:
            count = w[-1] - w[ri - 1]
            li -= 2
            if li >= 0:
                if li % 2 == 0:
                    count += w1[li]
                else:
                    count += w2[li]
            dic[x] = count
            print(count)
            return 0
        if A[ri - 1] == x + m:
            ri2 = ri - 1
            if n - ri2 == ri2 - li:
                count = w[-1] - w[ri2 - 1]
                li -= 1
                if li >= 0:
                    if li % 2 == 0:
                        count += w1[li]
                    else:
                        count += w2[li]
                dic[x] = count
                print(count)
                return 0
            elif n - ri2 == ri2 - li + 1:
                count = w[-1] - w[ri2 - 1]
                li -= 2
                if li >= 0:
                    if li % 2 == 0:
                        count += w1[li]
                    else:
                        count += w2[li]
                dic[x] = count
                print(count)
                return 0
        if 2 * ri > n + li:
            r = m
        else:
            l = m
    count = max(w1[-1], w2[-1])
    dic[x] = count
    print(count)
    return


for _ in range(q):
    x = int(eval(input()))
    solve(x)

n, q = list(map(int, input().split()))
A = list(map(int, input().split()))
w = [A[0]]
for i in range(1, n):
    w.append(w[-1] + A[i])
w1 = [0] * n
for i in range(n):
    if (n - 1 - i) % 2 == 0:
        w1[i] = A[i]
    if i > 0:
        w1[i] += w1[i - 1]


def solve(x):
    l = 0
    r = n + 1
    while r - l > 1:
        m = (r + l) // 2
        if A[n - m] <= x:
            r = m
        else:
            if 2 * m - 1 > n:
                r = m
            else:
                if A[n - m] - x >= x - A[n - 2 * m + 1]:
                    l = m
                else:
                    r = m
    ans = w[-1] - w[n - l - 1]
    if n - 2 * l - 1 >= 0:
        ans += w1[n - 2 * l - 1]
    print(ans)


for _ in range(q):
    solve(int(eval(input())))

-import bisect - -dic = {} -w1 = [A[0], 0] -w2 = [0, A[1]] -for i in range(2, n): -    if i % 2 == 0: -        w1.append(w1[-2] + A[i]) -        w2.append(0) -    else: -        w2.append(w2[-2] + A[i]) -        w1.append(0) +w1 = [0] * n +for i in range(n): +    if (n - 1 - i) % 2 == 0: +        w1[i] = A[i] +    if i > 0: +        w1[i] += w1[i - 1] -    if x in dic: -        print((dic[x])) -        return -    if x >= A[-1]: -        count = max(w1[-1], w2[-1]) -        dic[x] = count -        print(count) -        return -    r = 10**10 -    while r > l + 1: +    r = n + 1 +    while r - l > 1: -        li = bisect.bisect_left(A, x - m) -        ri = bisect.bisect_right(A, x + m) -        if n - ri == ri - li: -            count = w[-1] - w[ri - 1] -            li -= 1 -            if li >= 0: -                if li % 2 == 0: -                    count += w1[li] -                else: -                    count += w2[li] -            dic[x] = count -            print(count) -            return 0 -        if n - ri == ri - li + 1: -            count = w[-1] - w[ri - 1] -            li -= 2 -            if li >= 0: -                if li % 2 == 0: -                    count += w1[li] -                else: -                    count += w2[li] -            dic[x] = count -            print(count) -            return 0 -        if A[ri - 1] == x + m: -            ri2 = ri - 1 -            if n - ri2 == ri2 - li: -                count = w[-1] - w[ri2 - 1] -                li -= 1 -                if li >= 0: -                    if li % 2 == 0: -                        count += w1[li] -                    else: -                        count += w2[li] -                dic[x] = count -                print(count) -                return 0 -            elif n - ri2 == ri2 - li + 1: -                count = w[-1] - w[ri2 - 1] -                li -= 2 -                if li >= 0: -                    if li % 2 == 0: -                        count += w1[li] -                    else: -                        count += w2[li] -                dic[x] = count -                print(count) -                return 0 -        if 2 * ri > n + li: +        if A[n - m] <= x: -            l = m -    count = max(w1[-1], w2[-1]) -    dic[x] = count -    print(count) -    return +            if 2 * m - 1 > n: +                r = m +            else: +                if A[n - m] - x >= x - A[n - 2 * m + 1]: +                    l = m +                else: +                    r = m +    ans = w[-1] - w[n - l - 1] +    if n - 2 * l - 1 >= 0: +        ans += w1[n - 2 * l - 1] +    print(ans) -    x = int(eval(input())) -    solve(x) +    solve(int(eval(input())))