#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define fast ios::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main(){
fast
int n,m;
cin>>n>>m;
vector<int> a(n),b(m);
for(int i=0;i<n;i++)cin>>a[i];
for(int i=0;i<m;i++)cin>>b[i];
sort(all(a));
reverse(all(a));
sort(all(b));
// reverse(all(b));
int q;
cin>>q;
while(q--){
int k;
cin>>k;
vector<int> event(n+1);
int add = 0;
int ans = 0,at = 0;
for(int i=0;i<n;i++){
add += event[i];
int cur = add + a[i];
int need = k - cur;
if(need <= 0){
ans++;
continue;
}
for(int j=0;j<need && at < m;j++){
event[min(n , i + b[at])]--;
add++;
at++;
}
if(add + a[i] >= k)ans++;
}
cout << ans << ' ';
}
}
/*
1- Look at base case (n=1,m=1)
2- Overflow
3- Use assert
*/
Copy