#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define mp make_pair
#define pb push_back
#define endl '\n'
#define pi 3.1415926536
using namespace std;
ll powermod(ll _a,ll _b,ll _m){ll _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
ll string_to_number(string s){ll x=0; stringstream convert(s); convert>>x; return x;}
ll add(ll a,ll b){ll x = (a%mod + b%mod)%mod; return x; }
ll mul(ll a,ll b){ll x = (a%mod * b%mod)%mod; return x; }
ll sub(ll a,ll b){ll x = (a-b+mod)%mod; return x; }
ll divi(ll a,ll b){ll x = a;ll y = powermod(b,mod-2,mod);ll res = (x*y)%mod;return res;}

bool primes[100001]={0};
vector<int>v;
void prime(){
    
    primes[0]=1;
    primes[1]=1;
    for(int i=2;i<=100000;i++){
        if(!primes[i]){
            for(int j=i*2;j<=100000;j+=i){
                primes[j]=1;
            }
        }
    }
}

double fac(int n){
    if(n<=1)
        return 1.0;
    else
        return n * (fac(n-1));
}

void divisors(int n){
    
    for(int i=1;i<=sqrt(n);i++){
        
        if(n%i==0){
          if(n%i==i)v.pb(i);
            else{
                v.pb(i);
                v.pb(n/i);
            }
        }
    }
}

ll ncr(ll n,ll r,ll m){
    
    ll C[r+1]={0};
    C[0]=1;
    
    for(ll i=1;i<=n;i++){
        for(ll j=min(i,r);j>0;j--){
            C[j]=(C[j-1]+ C[j])%m;
        }
    }
    return C[r];
}

bool isPrime(ll n){
    
    if(n==0 || n==1)return false;
    
    for(ll i=2;i<=sqrt(n);i++){
        if(n%i==0)return false;
    }
    return true;
}

string convert(ll n){
    string s="";
    while(n){
        if((n%10)%2)s+='1';
        else s+='0';
        n/=10;
    }
    for(int i=s.size();i<=20;i++){
        s+='0';
    }
    reverse(s.begin(),s.end());
    return s;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n,m;
    cin>>n>>m;
    map<ll,ll>inp;
    map<ll,ll>mpp;
    for(int i=0;i<n;i++){
        ll x;
        cin>>x;
        inp[x]++;
        mpp[x]++;
    }
    for(int i=1;i<=100;i*=2){
        //cout<<i<<" "<<inp[i]<<endl;
        if(mpp[i]>1){
            mpp[i*2]+=(mpp[i]/2);
        }
    }
    
    while(m--){
        ll x;
        cin>>x;
        ll cnt=0;
        map<ll,ll>temp;
        bool flag=0;
        while(x){
            //cout<<b<<" ";
            ll t=log2(x);
            if(mpp[pow(2,t)]>0){
                ll a=1;
                ll k=pow(2,t);
                ll b=k;
                // cout<<"pochyu k nai??\n";
                while(k && b){
                    //cout<<k<<endl;
                    if(inp[k]>0){
                        //cout<<k<<endl;  
                       // cout<<"ahi ayu?\n";
                       // cout<<b<<" "<<min(inp[k],a)*k<<endl;
                        b-=min(inp[k],a)*k;
                        cnt+=min(inp[k],a);
                        temp[k]+=min(inp[k],a);
                        //break;
                    }
                    k/=2;
                    a*=2;
                }
                //cout<<b<<endl;
                if(b!=0){
                    //cout<<"uifjfkm";
                    cout<<-1<<endl;;
                    flag=1;
                    break;
                }
            }
            else{
               // cout<<"ahi padyu??";
                cout<<-1<<endl;
                flag=1;
            }
           // cout<<temp[1]<<endl;
           // cout<<
            if(flag)break;
            x-=pow(2,t);
        }
        
        for(auto it:temp){
            if(it.second>inp[it.first]){
               // cout<<it.second<<" "<<it.first<<" "<<inp[it.first]<<endl;
               // cout<<"K ahi??";
                cout<<-1<<endl;
                flag=1;
                break;
            }
        }
        if(!flag)cout<<cnt<<endl;
    }
    
    
    return 0;
}