import java.util.*

fun main(args: Array<String>) {
    solveProblem()
//    generateCases()
}

/*
7 1
4 31 38 47 56 97 99
77
 */

fun solveProblem() {
    val (N, Q) = readLine()!!.split(" ").map { it.toInt() }
    val A = readLine()!!.split(" ").map { it.toLong() }.toLongArray()
    val X = LongArray(Q) { readLine()!!.toLong() }

    val res = solve(A, N, X)
    res.forEach { println(it) }
//
//    val res2 = solveSlow(A, N, X)
//
//    res.zip(res2).forEach { println("${it.first} ${it.second}") }
}

fun solveSlow(A: LongArray, N: Int, X: LongArray): LongArray {
    val ret = LongArray(X.size)

    for (k in X.indices) {
        val x = X[k]
        val used = BooleanArray(N)
        var cnt = 0
        var res = 0L
        var choku = true

        while (cnt < N) {
            if (choku) {
                for (i in A.indices.reversed()) {
                    if (!used[i]) {
                        used[i] = true
                        res += A[i]
                        break
                    }
                }
            } else {
                var idx = -1
                for (i in A.indices) {
                    if (used[i]) continue

                    if (idx < 0 || Math.abs(A[idx] - x) > Math.abs(A[i] - x)) {
                        idx = i
                    }
                }
                used[idx] = true
            }
            ++cnt
            choku = !choku
        }

        ret[k] = res
    }

    return ret
}

private fun solve(A: LongArray, N: Int, X: LongArray): LongArray {
    val sum = LongArray(N + 1) { if (it == 0) 0L else A[it - 1] }
    for (i in 0 until N) {
        sum[i + 1] += sum[i]
    }

    val sumP = LongArray(N) { A[it] }
    for (i in 2 until N) {
        sumP[i] += sumP[i - 2]
    }

    for (i in A.indices) {
        A[i] = A[i] * 4 + 1
    }

    val ret = LongArray(X.size)

    for (y in X.indices) {
        val x = X[y] * 4
        var l = 0L
        var u = 1e11.toLong()

        while (u - l > 1) {
            val c = (l + u) / 2
            val up = lowerBound(A, x + c)
            val num = up - lowerBound(A, x - c)
            val tl = A.size - num

            if (up > tl) {
                u = c
            } else {
                l = c
            }
        }

        val au = lowerBound(A, x + l)
        val al = lowerBound(A, x - l)
        val tl = A.size - (au - al)
        var res = sum[N] - sum[au]

        if (au == tl) {
            if (al >= 1) {
                res += sumP[al - 1]
            }
        } else {
            if (al >= 2) {
                res += sumP[al - 2]
            }
        }

        ret[y] = res
    }

    return ret
}

fun lowerBound(a: LongArray, v: Long): Int {
    var l = -1
    var u = a.size

    while (u - l > 1) {
        val c = (l + u) / 2

        if (a[c] >= v) {
            u = c
        } else {
            l = c
        }
    }

    return u
}

fun upperBound(a: LongArray, v: Long): Int {
    var l = -1
    var u = a.size

    while (u - l > 1) {
        val c = (l + u) / 2

        if (a[c] > v) {
            u = c
        } else {
            l = c
        }
    }

    return u
}

private fun generateCases() {
    val random = Random()
    var cnt = 1

    while (true) {
        println("trial: #$cnt")

        val N = 3 + random.nextInt(5)
        val st = TreeSet<Long>()

        while (st.size < N) {
            st.add(random.nextInt(100) + 1L)
        }

        val A = st.toLongArray()
        val tmp = LongArray(N - 1) {
            (A[it + 1] + A[it]) / 2
        }

        val X = LongArray(60) { random.nextInt(st.last().toInt()) + 1L } +
                A + st.map { it - 1 } + st.map { it + 1 } +
                tmp + tmp.map { it - 1 } + tmp.map { it + 1 }

        val res = solve(A, N, X)
        val res2 = solveSlow(A, N, X)
        for (i in X.indices) {
            if (res[i] != res2[i]) {
                println("Case:")
                println("$N 1")
                println(A.joinToString(" "))
                println(X[i])

                return
            }
        }
        cnt++
    }
}


Measured memory_bytes: 61092