import java.util.Scanner

object Main extends App { 
  val sc = new Scanner(System.in)
  val _N, _Q = sc.nextInt()
  val _An = (for (i <- 0 until _N) yield sc.nextLong()).toArray
  val _Xq = (for (i <- 0 until _Q) yield sc.nextLong()).toList

  def count(x:Long, n:Int, arr:Array[Long]):Long = {
    def iter(l:Int, r:Int, ac:Long, cnt:Long):Long = {
      if (l == n) cnt
      else if (r < n && ac + arr(r) <= x) iter(l, r+1, ac + arr(r), cnt)
      else iter(l+1, r, ac - arr(l), cnt + r - l)
    }
    iter(0, 0, 0, 0)
  } 

  def solver(list:List[Long], acc:List[Long]):List[Long] = {
    if (list.isEmpty) acc.reverse
    else solver(list.tail, count(list.head, _N, _An)::acc)
  }

  solver(_Xq, Nil).foreach(println)

}

