from itertools import accumulate n, q = map(int, input().split()) a = list(map(int, input().split())) b = [] for i in a: for j in range(1, i+1): b.append(j) # print(b) rui = list(accumulate(b, initial=0)) # print(rui) for i in range(q): x = int(input()) ng = -1 ok = len(rui) while abs(ok-ng) > 1: mid = (ok+ng)//2 if rui[mid] >= x: ok = mid else: ng = mid if ok == len(rui): print(-1) else: print(ok)