#pragma once
#include <stdio.h>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

// res[i][c] := i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
vector<vector<int> > calcNext(const string& S) {
	int n = (int)S.size();
	vector<vector<int> > res(n + 1, vector<int>(26, n));
	for (int i = n - 1; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j];
		res[i][S[i] - 'a'] = i;
	}
	return res;
}
// mod 1000000007 の世界で a += b する関数
void add(long long& a, long long b) {
	a += b;
	if (a >= MOD) a -= MOD;
}
ll slide(vector<ll>& v, ll a, ll b) {
	ll azv = abs(v[0] - a);
	ll bzv = abs(v[0] - b);
	ll aov = abs(v[1] - a);
	ll bov = abs(v[1] - b);
	v[0] = a;
	v[1] = b;
	return max((azv + bov), (bzv + aov));
}


ll a[100010];
ll ac[100010];
ll as[100010];
int n, q;
ll calc(ll x) {

	ll high = a[n - 1];
	ll low = x;
	int hi = 0;
	int li = 0;
	int in = 0;
	if (x >= a[n - 1]) {
		return ac[n - 1];
	}
	while (in < 50)
	{
		ll mid = (high + low) / 2;
		ll *hp = lower_bound(a, a + n, mid);
		if (mid < *hp && hp != a) {
			hp--;
		}
		ll *lp = lower_bound(a, a + n, x - (mid - x));
		if (*lp > *hp) {
			lp--;
		}
		ll c = (hp - a) - (lp - a) + 1;
		ll tc = (n - ((hp - a) + 1));
		in++;
		if (c + tc > n) {
			high = mid;
			continue;
		}

		hi = hp - a;
		li = lp - a;

		if (c == tc) {
			break;
		}

		if (c > tc) {
			high = mid;
		}
		else {
			low = mid;
		}
	}

	int ptc = n - ((hi - li) + 1);
	int thi = hi;
	int turn = 0;
	while (hi < ptc)
	{
		if (turn % 2 == 0) {
			if (ptc - 1 == hi) break;
			ptc--;
		}
		else {
			if (hi + 1 == ptc) {
				li--;
			}
			else if (li - 1 < 0){
				if (hi + 1 == ptc) {
					break;
				}
				hi++;
			}
			else {
				ll hv = a[hi + 1];
				ll lv = a[li - 1];
				if (hv - x >= lv - x) {
					li--;
				}
				else hi++;
			}
		}

		turn++;
	}
	return (as[n - 1] - as[hi]) + (li <= 0 ? 0 : ac[li - 1]);
}
void solv() {

	cin >> n >> q;

	for (size_t i = 0; i < n; i++)
	{
		cin >> a[i];
		as[i] = a[i];
		if (i > 0) as[i] += as[i - 1];
	}
	sort(a, a + n);
	ac[0] = a[0];
	ac[1] = a[1];
	for (size_t i = 2; i < n; i++)
	{
		ac[i] = a[i] + ac[i - 2];
	}
	ll x[100010];
	for (size_t i = 0; i < q; i++)
	{
		cin >> x[i];
	}

	for (size_t i = 0; i < q; i++)
	{
		cout << calc(x[i]) << endl;
	}
}




int main() {
	//COMinit();
	solv();

	return 0;
}


Measured memory_bytes: 6528