import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val q = sc.nextInt()
    val a = (0 until n).map { sc.next().toLong() }
    val x = (0 until q).map { sc.next().toLong() }
    println(problemdsl3c(n, q, a, x))
}

fun problemdsl3c(
    n: Int,
    q: Int,
    a: List<Long>,
    x: List<Long>
): String {
    val ans = mutableListOf<Long>()
    for (i in 0 until q) {
        val xi = x[i]
        val counts = mutableListOf<Long>()
        var sum = 0L
        var right = 0
        for (left in 0 until n) {
            while (right < n && sum + a[right] <= xi) {
                sum += a[right]
                right++
            }
            counts.add(right.toLong() - left)
            if (right == left) right++ else sum -= a[left]
        }
        ans.add(counts.sum())
    }
    return ans.joinToString("\n")
}
