#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef unsigned int uint;
typedef long double ld;
//#define ll __int128
#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<pii> vpi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a,b) make_pair(a,b)
#define modsum(a, b) ((a) + (b) >= M ? (a) + (b) - M : (a) + (b))
#define modsubtract(a, b) ((a) - (b) < 0 ? (a) - (b) + M : (a) - (b))
#define modmultiply(a, b) (((a) * (b)) % M)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define cint const int &
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;

const double PI = atan2(1, 0) * 2;

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template<class T>
ostream & operator << (ostream &out, vector<T> &a) {
    out << "{";
    for (auto x : a) out << x << " ";
    return out << "}";
}

void smain();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);


#ifdef ART_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef ART_HOME
    cout << "\n\n\n";
    cout << "TOTAL EXECUTION TIME: " << float(clock() - start) / CLOCKS_PER_SEC << endl;
#endif
}


vi values;
vi cnt;
vi with, out;


int stupid1()
{
    int n = SZ(values);

    if (n == 1)
        return cnt.back();
    else
        return cnt.back() - cnt[n / 2 - 1];
}


int stupid2()
{
    return with[SZ(values) - 1];
}


int count(int d, int u)
{
    int l = -1, r = SZ(values);
    while (r - l > 1)
    {
        int m = (l + r) >> 1;

        if (values[m] > u)
            r = m;
        else
            l = m;
    }

    int up = l;

    l = -1, r = SZ(values);
    while (r - l > 1)
    {
        int m = (l + r) >> 1;

        if (values[m] >= d)
            r = m;
        else
            l = m;
    }

    int dow = r;

    return up - dow + 1;
}


bool check(int m, int v)
{
    int n = SZ(values);
    int up = values[m - 1];
    int down = v - abs(v - values[m - 1]);
    return count(down, up) <= SZ(values) - m;
}


int more(int v)
{
    int l = -1, r = SZ(values);
    while (r - l > 1)
    {
        int m = (l + r) >> 1;
        if (values[m] >= v)
            r = m;
        else
            l = m;
    }

    return r;
}


int solution(int v)
{
    if (v <= values[0])
        return stupid1();

    if (v >= values.back())
        return stupid2();

    int n = SZ(values);
    int l = more(v), r = n;

    while (r - l > 1)
    {
        int m = (l + r) >> 1;

        if (check(m, v))
            l = m;
        else
            r = m;
    }

    int ans = cnt.back() - cnt[l - 1];
    int left = l - (n - l);

    if (left <= 0)
        return ans;

    if (n - l > l - left)
        return ans + out[left - 1];
    else
        return ans + with[left - 1];
}


void smain() {
    int n, q;
    cin >> n >> q;
    values.resize(n);
    cnt.resize(n);
    with.resize(n);
    out.resize(n);

    for (int i = 0; i < n; ++i)
        cin >> values[i];

    cnt[0] = values[0];
    for (int i = 1; i < n; ++i)
        cnt[i] += values[i] + cnt[i - 1];

    with[0] = values[0];

    for (int i = 1; i < n; ++i)
    {
        with[i] = out[i - 1] + values[i];
        out[i] = with[i - 1];
    }

    for (int i = 0; i < q; ++i)
    {
        int v;
        cin >> v;
        cout << solution(v) << '\n';
    }
}

Measured memory_bytes: 4864