import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int q = scanner.nextInt();

        int[] cnt = new int[32 + 5];
        for (int i = 0; i < n; i++)
        {
            int a = scanner.nextInt();

            int k;
            for (k = 0; 1 << k < a; k++);

            cnt[k]++;
        }

        int[][] dp = new int[32 + 5][32 + 5];
        for (int i = 0; i <= 32; i++)
        {
            int k = 0;
            if (cnt[i] > 0)
            {
                for (k = 0; 1 << k <= cnt[i]; k++)
                    dp[i][k] = 1 << k;

            }

            if (i > 0)
                for (k = k + 1; k <= 32; k++)
                    dp[i][k] = dp[i - 1][k + 1] * 2;
        }

        for (int i = 0; i < q; i++)
        {
            int a = scanner.nextInt();

            int minAns = 0;
            boolean lc = true;
            while (a > 0)
            {
                int lsb = a & (-a);

                int k;
                for (k = 0; 1 << k < lsb; k++);

                if (dp[k][0] == 0)
                {
                    System.out.println(-1);
                    lc = false;

                    break;
                }

                minAns += dp[k][0];
                a -= lsb;
            }

            if (lc)
                System.out.println(minAns);
        }
    }
}