n, m = map(int, input().split())
a = list(map(int, input().split()))
b = [int(input()) for i in range(m)]
a.sort()
x = []
for i in a:
    x.append(i)
for i in range(m):
    f = False
    k = 0
    a = x
    while b[i] > 0 and a and b[i] > a[0]:
        if a[-1] <= b[i]:
            k += 1
            b[i] -= a[-1]
        if b[i] == 0:
            f = True
            break
        a.pop()
    if f:
        print(k)
    else:
        print(-1)