#include<iostream>
#include<vector>

using namespace std;
vector<int> sortiraj(vector<int> a){
unsigned int i=0;
for(i=0;i<a.size()-1;i++){
    if(a[i]>a[i+1]){
        unsigned pom=a[i];
        a[i]=a[i+1];
        a[i+1]=pom;
    }
}
return a;
}
 int medijana(vector<int> a){
return a[a.size()/2];
}
int ima(vector<int> a,int x){
    unsigned int i=0;
for(auto z:a){
    if(z==x)return i;
    i++;
}
return -1;
}
int resenje(int x,vector<int> a,int n){
if(x==medijana(a))return 0;
if(ima(a,x)!=-1){
    unsigned int y=ima(a,x)*2;
    if(y<a.size())return n-y;
    else return y-n;
}
else{
    a.push_back(x);
    return resenje(x,sortiraj(a),n);
}
return -1;
}
int main(){
std::iostream::sync_with_stdio(false);
cin.tie(NULL);
unsigned int n,q;
cin>>n>>q;
vector<int> a;
for(int i=0;i<n;i++){
    int x;
    cin>>x;
    a.push_back(x);
}
for(int i=0;i<q;i++){
    int x;
    cin>>x;
    cout<<resenje(x,sortiraj(a),a.size())<<"\n";
}
}