#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <stdio.h>
#include <string.h>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS * max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x * x + y * y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;


// ≦X の要素数を求める。
template <class T>
int numLTE(const vector <T>& v, T x)
{
	return upper_bound(v.begin(), v.end(), x) - v.begin();
}

int main() 
{
	int N, Q;
	scanf("%d %d", &N, &Q);

	vector <ll> a(N);
	vector <ll> basex(Q);

	for (int i = 0; i < N; ++i)
	{
		scanf("%lld ", &a[i]);
	}

	for (int i = 0; i < Q; ++i)
	{
		scanf("%lld ", &basex[i]);
	}

	sort(a.begin(), a.end());

	const int M = (N + 1) / 2;

	vector <ll> sum_hi(M+1);
	vector <ll> sum_lo(M + 1);

	for (int i = 0; i < M; ++i)
	{
		sum_hi[i + 1] = sum_hi[i] + a[N-1-i];
		sum_lo[i + 1] = sum_lo[i] + a[N - 1 - 2 * i];
	}

	for (ll x : basex)
	{
		// 高橋君が上位何個まで取れるかを求める。

		ll lo = 1;
		ll hi = (N+1)/2;

		while (lo<hi)
		{

			ll mid = lo + (hi - lo + 1) / 2LL; // +1 is necessary, otherwise infinite loop when only two elements.

			// BEGIN CUT HERE
//			cerr << " mid=" << mid << endl;
			// END CUT HERE


			ll y = a[N - mid]; // 高橋君がとろうとしている
			// BEGIN CUT HERE
//			cerr << " y=" << y << endl;
			// END CUT HERE


			ll aokiNum = 0;
			if (x < y)
			{
				// [2x-y, y]
				aokiNum = numLTE(a, y) - numLTE(a, 2*x-y-1);
			}
			else
			{
				// [y, 2x-y-1]
				aokiNum = NG; //  numLTE(a, 2 * x - y - 1) - numLTE(a, y - 1);
			}

			// chokudaiNum > aokiNum chokudai勝ち
			// chokudaiNum = aokiNum chokudai勝ち
			// chokudaiNum < aokiNum aoki勝ち

			// BEGIN CUT HERE
//			cerr << " mid=" << mid << " aokiNum=" << aokiNum << endl;
			// END CUT HERE



			if (!(mid <= aokiNum))
			{
				hi = mid - 1; // chokudaiさげる
			}
			else
			{
				lo = mid;
			}
		}

		const ll chokuNum = lo;
		ll ans = 0;
		ll realAns = 0;

		// BEGIN CUT HERE
//		cerr << " chokuNum=" << chokuNum << endl;
		// END CUT HERE

/*
		for (int i = 0; i<chokuNum; ++i)
		{
			ans += a[N - 1 - i];
		}
*/


		realAns += sum_hi[chokuNum];

/*
		for (int i = chokuNum; i<M; ++i)
		{
			ans += a[N - 1 - 2 * i];
		}
*/

		realAns += sum_lo[M] - sum_lo[chokuNum];

		cout << realAns << endl;
	}




#if 0
	const int N = 11;

	vector <int> a;


	for (int i = 0; i < N; ++i)
	{
		a.push_back(2*i*i+3*i+4);
	}


	for (int x = -5; x < a.back()+5; ++x)
	{
		// BEGIN CUT HERE
		cerr << " x=" << x << endl;
		// END CUT HERE

		vector <bool> used(N);
		int sum = 0;
		while (1)
		{
			{
				int best = NG;
				int bestID = NG;

				for (int i = 0; i < N; i++)
				{
					if (!used[i] && a[i]>best)
					{
						best = a[i];
						bestID = i;
					}
				}

				if (bestID == NG) break;

				printf("tkhs=%d, ", bestID);
				sum += best;
				used[bestID] = true;
			}

			{
				int best = BIG;
				int bestID = NG;

				for (int i = 0; i < N; i++)
				{
					if (!used[i] && abs(a[i]-x)<best || (abs(a[i] - x)==best && a[i] < best))
					{
						best = abs(a[i] - x);
						bestID = i;
					}
				}

				if (bestID == NG) break;

				printf("aoki=%d, ", bestID);
				used[bestID] = true;
			}
		}

		// BEGIN CUT HERE
		cerr << " sum=" << sum << endl;
		// END CUT HERE
	}
#endif





	return 0;
}


Measured memory_bytes: 4096