import bisect from itertools import accumulate n,q=map(int,input().split()) a=list(map(int,input().split())) a_ind=list(accumulate(a)) b=[] for i in a: b.append(i*(i+1)//2) b=list(accumulate(b)) for _ in range(q): s=int(input()) ind=bisect.bisect_right(b,s) if ind==n and b[ind-1]1: mid=(ok+ng)//2 if mid*(mid+1)//2>=s: ok=mid else: ng=mid ans+=ok print(ans)