#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  
using namespace __gnu_pbds;  
using namespace std;   
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>   ordered_set;  
typedef long long ll;
#define mp make_pair
#define rep(i,k,n) for(int i=k;i<n;i++)
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define boostt ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
const ll mod = 1000000007LL;
const ll inf = 2e18;
const ll N = 1e5;
ll fastpow(ll a,ll b){
  ll res = 1;
  while(b>0){
   if(b&1){
    res = res*a;
   }
   b = b>>1LL;
   a = a*a;
  }
return res;
}
/*------------------------------------------------------CREATED BY : PRAJJWAL SONI-----------------------*/
signed main(){
    boostt;
    ll n,q;
    cin>>n>>q;
    unordered_map< ll ,ll > mpp;
    for(ll i=0;i<n;i++){
        ll x;
        cin>>x;
        for(ll j=30;j>=0;j--){
            if(x&(1LL<<j)){
                mpp[j]++;
            }
        }
    }
    for(ll i=1;i<=q;i++){
        ll y;
        cin>>y;
        unordered_map< ll , ll > mp;
        for(ll j=0;j<=30;j++){
            mp[j] = mpp[j];
        }
        ll cnt = 0;
        for(ll k=30;k>=0;k--){
            if(y&(1LL<<k)){
                ll z = 1LL<<k;
                for(ll j=k;j>=0;j--){
                     if((1LL<<j) <= z && mp[j]){
                        ll tmp = z / (1LL<<j);
                        cnt+=min(tmp,mp[j]);
                        z = z - min(tmp,mp[j])*(1LL<<j);
                        mp[j]-=(tmp,mp[j]);
                     }
                }
                if(z){
                    cnt = -1;
                    break;
                }
            }
        }
        cout << cnt << '\n';
    }
}