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

public class Main {
    public static void main(String[] args) {
        FastReader in = new FastReader();
        
        int n = in.nextInt();
        int q = in.nextInt();
        long number =0,temp;
        for(int i=0 ;i<n ;i++) number|=in.nextInt();
        for(int i=0 ;i<q ;i++){
            temp = in.nextInt();
            if((temp-number)%2==0 && number>=temp){
                int count;
                    for (count = 0; temp > 0; ++count) {
                        temp &= temp - 1;
                    }
                System.out.println(count);
            }else System.out.println(-1);
        }

    }
    
    static class FastReader  {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt()
        {
            return Integer.parseInt(next());
        }
 
        long nextLong()
        {
            return Long.parseLong(next());
        }
 
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}
