from sys import stdin
n,q = map(int,stdin.readline().split())
a = map(int,stdin.readline().split())
a = list(set(a))
a.sort()
b=list(a)
b.reverse()
for i in xrange(q):
    x = int(stdin.readline())
    if x % a[0]:
        print -1
    else:
        ans=0
        for j in b:
            y=x/j
            ans +=y
            x-=y*j
print ans
        