import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}



enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;


void main() {
    int N, Q;
    scan(N, Q);
    auto a = readln.split.to!(int[]).assumeSorted;

    auto kogo = new long[](N + 1);
    kogo[1] = (N % 2 ? a[0] : 0);
    kogo[2] = (N % 2 == 0 ? a[1] : 0);
    foreach (i ; 2 .. N + 1) {
        kogo[i] = kogo[i - 2] + a[i - 1];
    }

    auto as = new long[](N + 1);
    foreach (i ; 1 .. N + 1) {
        as[i] = as[i - 1] + a[i - 1];
    }

    // tkが上から連続してk個取れるか？
    bool check(int x, int k) {
        if (a[N - k] <= x) {
            return false;
        }
        if (k + k - 1 > N) {
            return false;
        }

        auto d = abs(a[N - k] - x);
        int c = a.lowerBound(x + d).upperBound(x - d - 1).length.to!int;
        return c >= k - 1;
    }

    long f(int x) {
        int ok = 0, ng = N;
        while (abs(ok - ng) > 1) {
            auto mid = (ok + ng) / 2;
            (check(x, mid) ? ok : ng) = mid;
        }
        debug {
            writeln("ok: ", ok);
        }
        auto ans = as[N] - as[N - ok] + kogo[max(0, N - 2*ok)];
        return ans;
    }

    foreach (_ ; 0 .. Q) {
        int xi;
        scan(xi);
        auto ans = f(xi);
        writeln(ans);
    }
}
