from collections import defaultdict
import sys
input = sys.stdin.readline

n, q = map(int, input().split())
a = list(map(int, input().split()))
cnt = defaultdict(lambda : 0)
for i in a:
    cnt[i] += 1
pow2 = [1]
for _ in range(35):
    pow2.append(2 * pow2[-1])
for _ in range(q):
    x = [0] * 35
    b = int(input())
    ans = 0
    f = 1
    for i in range(35):
        p2 = pow2[i]
        if b < p2:
            break
        if p2 & b:
            if cnt[p2] - x[i] > 0:
                ans += 1
                x[p2] += 1
            else:
                c, j = 2, i - 1
                ok = 0
                while j >= 0:
                    p2 //= 2
                    if cnt[p2] - x[j] >= c:
                        x[j] += c
                        ans += c
                        ok = 1
                        break
                    else:
                        cc = cnt[p2] - x[j]
                        x[j] += cc
                        c -= cc
                        ans += cc
                    c *= 2
                    j -= 1
                if not ok:
                    f = 0
        if not f:
            ans = -1
            break
    print(ans)