n, q = [int(i) for i in input().split()]
coins = sorted([int(i) for i in input().split()])
print(coins)
maxQ = sum(coins)
minQ = coins[0]

for i in range(q):
    query = int(input())
    if(query > maxQ or query % minQ != 0):
        print(-1)
    else:
        t = 0
        i = n-1
        while(query > 0):
            if(query >= coins[i]):
                query -= coins[i]
                t += 1
            i -= 1
        if(query == 0):
            print(t)
        else:
            print(-1)