from bisect import bisect_left, bisect_right def Binary_Search_Small_Count(A: list, x, equal = False, sort = False): """ 二分探索によって, A の元のうち, x より小さい元の個数を求める. Args: A (list): 探索対象のリスト x : 閾値 equal (bool, optional): True のときは「x より小さい」が「x 以下」になる. Defaults to False. sort (bool, optional): A が昇順であることが保証されていないとき, True にすることで実行時にソートを行う. Defaults to False. Returns: int: x より小さい元の個数 """ if sort: A.sort() if equal: return bisect_right(A, x) else: return bisect_left(A, x) #================================================== def solve(): from itertools import accumulate N, Q = map(int, input().split()) T = list(map(int, input().split())) C = list(accumulate(T)) for q in range(Q): X = int(input()) yield Binary_Search_Small_Count(C, X, True) #================================================== import sys input = sys.stdin.readline write = sys.stdout.write write("\n".join(map(str, solve())))