#include<bits/stdc++.h>
using namespace std;
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define dbg(x) cerr<<#x" = "<<x<<endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define rep(i,a,b) for(register int i=(a),i##_end=(b);i<=i##_end;++i)
#define per(i,a,b) for(register int i=(a),i##_st=(b);i>=i##_st;--i)
#define For(i,a,b) for(register int i=(a),i##_end=(b);i<=i##_end;++i)
#define rpg(i,x) for(register int i=fir[x];i;i=e[i].nxt)
#define ull unsigned long long
#define fi first
#define se second
#define pb push_back
#define bin(i) (1<<i)
#define cls(x,y) memset(x,y,sizeof x)
typedef pair<int,int> PII;
typedef long long LL;
const int INF = 0x7fffffff;
/*const int _L = 1e6+5;
char ibuf[_L],*ih=ibuf+_L;
inline char gc(){return (ih==ibuf+_L?fread(ibuf,1,_L,stdin),ih=ibuf:0),*ih++;}
#define  getchar() gc() //*/
template <typename T> inline void rd(T &x) {
    x = 0; int f = 1; char CH = getchar();
    while(!isdigit(CH)) {if(CH=='-')f=0;CH=getchar();}
    while(isdigit(CH)) {x=((x+(x<<2))<<1)+(CH-48);CH=getchar();}
    x=(f==1)?x:-x;  return;
}
const int MXN = 2e5 + 5;
#define int long long
int n,q;
int a[MXN],vis[60],use[40];
inline int trans(int x) {
	rep(i,0,35) {
		if(x&bin(i)) return i;
	}
}
main() {
#ifdef iloi
	   freopen("test.in","r",stdin);
#endif
	rd(n); rd(q);
	rep(i,1,n) rd(a[i]),vis[trans(a[i])]++;
	while(q--) {
		bool flag=0; int ans=0,nd;
		rd(nd); memset(use,0,sizeof use);
		per(i,32,0) {
			if(nd&bin(i)) {
				use[i]++;
			}
			if(vis[i]) {
				ans+=(use[i]<=vis[i]?use[i]:vis[i]);
				use[i]-=vis[i];
//				if(i==0) dbg(use[i]);
			}
			if(use[i]>0) use[i-1]=use[i]<<1;
			use[i]=0;
		}
		per(i,32,0) {
//			dbg(use[i]);
			if(use[i]>0) flag=1;
		}
		if(flag) puts("-1");
		else printf("%d\n",ans);
//		dbg(ans);
	}
#ifdef iloi
	debug("\nMy Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
#endif
}

