import sys
import io

stream_enable = 0

inpstream = """
5 4
2 4 8 2 4
8
5
14
10
"""

if stream_enable:
    sys.stdin = io.StringIO(inpstream)
    input()

def inpmap():
    return list(map(int, input().split()))

n, q = inpmap()
arr = inpmap()

b = [0] * 32
for x in arr:
    a = 0
    while x > 1:
        a += 1
        x //= 2
    b[a] += 1
print(b)

for i in range(q):
    bb = b[:]
    x = int(input())
    r = 0
    for i in range(31, -1, -1):
        y = 2 ** i
        c = min(bb[i], x // y)
        r += c
        bb[i] -= c
        x -= c * y
    if x:
        print(-1)
    else:
        print(r)

