import java.util.*;
import java.io.*;

public class D1003 
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int q = in.nextInt();
		long[] a = new long[n];
		long b;
		int j = n-1,ans=0;
		
		for(int i=0;i<n;i++)
			a[i] = in.nextLong();
		
		Arrays.sort(a);
		
		for(int i=0;i<q;i++)
		{
			b = in.nextLong();
			
			while(b!=0)
			{
				if(b>=a[j])
				{
					b = b%a[j];
					ans++;
				}
				
				j--;
				
				if(b!=0 && b<a[0])
				{
					ans = -1;
					break;
				}
			}
			
			System.out.println(ans);
			ans = 0;
			j = n-1;
		}
	}

}
