#include <iostream>
#include <bits/stdc++.h> 
#include <queue>



using namespace std;

int main()
{
    int n,q,i,x,ib,m,ij,v,mv;
    cin>>n>>q;
    vector<int>a(n);
    priority_queue<int>p;
    vector<int>s;
    m=n/2;
    for(i=0;i<n;i++){
        cin>>x;
        p.push(-x);
    }
    for(i=0;i<n;i++){
        x=p.top();
        p.pop();
        a[i]=-x;
    }
    while(q>0){
        cin>>x;
        v=-1;
        ib=0;
        for(i=0;i<n;i++){
            if(a[i]==x){
                ib=i;
                v=1;
                break;
            }
            if(a[i]<x){
                ib=i+1;
            }
        }
        if(v==-1){
            mv=(n+1)/2;
            if(ib==mv){
                s.push_back(1);
            }
            if(ib<mv){
                ij=n-ib;
                x=ij-ib;
                s.push_back(x+1);
            }
            if(ib>mv){
                ij=n-ib;
                x=ib-ij-1;
                s.push_back(x+1);
            }
        }
        else{
            if(ib<m){
                while(a[ib]==a[ib+1]){
                    i++;
                }
            }
            if(ib==m){
                s.push_back(0);
            }
            if(ib<m){
                ij=n-1-ib;
                x=ij-ib;
                s.push_back(x);
            }
            if(ib>m){
                ij=n-1-ib;
                x=ib-ij-1;
                s.push_back(x);
            }
            //cout<<x;
        }
        q--;
    }
    for(i=0;i<s.size();i++){
        cout<<s[i]<<"\n";
    }
}