#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef long long ll;
using namespace std;

const int N=200010;
int n,Q,x,a[N];
ll sm[N],s[N];

void get(int x,int k,int &l,int &r){
	int d=lower_bound(a+1,a+n+1,x)-a,L=0,R=d-1;
	if (x<a[1]) { l=1; r=k; return; }
	if (x>a[n]) { l=n-k+1; r=n; return; }
	while (L<R){
		int mid=(L+R+1)>>1;
		if (d+k-mid-1>n) { L=mid+1; continue; }
		if (d+k-mid>n || x-a[d-mid]<=a[d+k-mid]-x) L=mid; else R=mid-1;
	}
	l=d-L; r=d+k-L-1;
}

int main(){
	scanf("%d%d",&n,&Q);
	rep(i,1,n) scanf("%d",&a[i]);
	sort(a+1,a+n+1); sm[1]=a[1]; sm[2]=a[2];
	rep(i,3,n) sm[i]=sm[i-2]+a[i];
	rep(i,1,n) s[i]=s[i-1]+a[i];
	while (Q--){
		scanf("%d",&x);
		int L=0,R=n;
		while (L<=R){
			int mid=(L+R)>>1,l,r; get(x,mid,l,r);
			if (r==n-mid){ printf("%lld\n",sm[l-1]+s[n]-s[r]); break; }
			if (r+1==n-mid){ printf("%lld\n",sm[l-2]+s[n]-s[r]); break; }
			if (r<n-mid) L=mid+1; else R=mid-1;
		}
	}
	return 0;
}