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

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

int[] di = [1, 0, -1, 0];
int[] dj = [0, 1, 0, -1];

void main() {
    int n, q;
    scan(n, q);
    auto a = readln.split.to!(int[]).sort();
    auto x = iota(q).map!(i => readln.chomp.to!int).array;

    bool[int] set;

    foreach (ai ; a) {
        set[ai] = true;
    }

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

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

    debug {
        writeln(kogo);
        writeln(usiro);
    }

    bool check(int x, int k) {
        int ai = a[n - k];
        if (ai <= x) {
            return false;
        }
        // ai > x
        auto d = ai - x;
        debug {
            writeln(k);
            writeln(a.upperBound(x - d - 1).lowerBound(x + d));
        }
        auto cnt = a.upperBound(x - d - 1).lowerBound(x + d).length.to!int;
        return cnt >= k - 1;
    }

    foreach (xi ; x) {
        if (xi >= a[n - 1]) {
            long ans = kogo[n];
            writeln(ans);
            continue;
        }

        int ok = 1, ng = n + 1;

        while (abs(ok - ng) > 1) {
            int mid = (ok + ng) / 2;
            if (check(xi, mid)) {
                ok = mid;
            }
            else {
                ng = mid;
            }
        }

        int k = ok;

        if (k == 1) {
            long ans = kogo[n];
            writeln(ans);
            continue;
        }


        long ans = usiro[k];
        int d = a[n - k] - xi;
        auto r = max(0, a.lowerBound(xi - d).length.to!int - 1);

        debug {
            writeln;
            writefln("k:%d, x - d: %d", k, xi - d);
            writeln(r);
        }

        ans += kogo[r];
        writeln(ans);
    }
}


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;
}

long powmod(long x, long y, long mod = 1_000_000_007L) {
    long res = 1L;

    while (y > 0) {
        if (y & 1) {
            (res *= x) %= mod;
        }
        (x *= x) %= mod;
        y >>= 1;
    }

    return res;
}