import java.io.*;
import java.util.*;
public class D
{
    private static int bSearch(long a[],long val, int N)
    {
        int l=0,r=N,mid,ans=-1;

        while(l<=r)
        {
            mid=(l+r)/2;

            if(a[mid]<=val)
            {
                ans=mid;
                l=mid+1;
            }
            else
                r=mid-1;
        }
        return ans;
    }
    private static long solve(long a[], long val, int N, long ans)
    {
        int i=N-1,pos;

        while(val>0)
        {
            pos=bSearch(a,val,i);

            if(pos==-1)
                return pos;

            long tmp=val/a[pos];

            ans+=tmp;

            val-=a[pos]*tmp;
        }

        return ans;
    }
    public static void main(String[] args) throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

        int i,N,Q;
        long ans,val;

        String s[]=br.readLine().trim().split(" ");

        N=Integer.parseInt(s[0]);
        Q=Integer.parseInt(s[1]);

        long a[]=new long[N];

        s=br.readLine().trim().split(" ");

        for(i=0;i<N;i++)
          a[i]=Long.parseLong(s[i]);

        Arrays.sort(a);

        StringBuilder sb=new StringBuilder();

        while(Q-->0)
        {
            val=Long.parseLong(br.readLine().trim());

            ans=0;

            ans=solve(a,val,N,ans);

            sb.append(ans).append("\n");
        }
        System.out.println(sb);
    }
}
