N, Q = map(int, input().split())
A = list(map(int, input().split()))
X = [int(input()) for _ in range(Q)]

A.sort()
B = [0 for _ in range(N + 1)]
for i in range(N):
    B[i + 1] = A[i] + B[i]


def solve(x: int) -> int:
    l = 0
    r = N
    while l < r:
        m = (l + r) // 2
        if A[m] <= x:
            l = m + 1
        else:
            r = m
    k = l
    return k * x - B[k] + B[N] - B[k] - (N - k) * x


for q in range(Q):
    print(solve(X[q]))
