from itertools import accumulate from bisect import bisect_left def main(): n, q = map(int, input().split()) a = [0] + list(map(int, input().split())) aa = [ai * (ai + 1) // 2 for ai in a] acc = list(accumulate(aa)) for _ in range(q): s = int(input()) if s > acc[-1]: print(-1) continue k = bisect_left(acc, s) if s == acc[k]: print(sum(a[:k + 1])) continue left = 0 right = a[k] + 1 while right - left > 1: mid = (right + left) // 2 if acc[k - 1] + mid * (mid + 1) // 2 >= s: right = mid else: left = mid print(sum(a[:k]) + right) if __name__ == "__main__": main()