#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int index(vector<int> a, int bgin, int endg, int elm) {
    if (bgin==endg) return 0;
    if(a[bgin] == elm) return bgin;
    else return index(a, bgin+1,endg, elm);
}


int glasovi(vector<int> a, int b) {
    int n,m,k;
    k=index(a,0,a.size(),b);
    if(k==0){
        a.push_back(b);
        sort(a.begin(),a.end());
        m=index(a,0,a.size(),b);
        if(a.size()%2!=0) {
                n=(a.size()-1)/2;
                if(n>=m) return (n-m)*2+1;
                else return (m-n)*2-1+1;
        } else {
                n=a.size()/2;
                if(n>=m) return (n-m)*2-1+1;
                else return (m-n)*2+1;
        }
    } else {
        m=index(a,0,a.size(),b);
        if(a.size()%2!=0) {
            n=(a.size()-1)/2;
            if(n>=m) return (n-m)*2;
            else return (m-n)*2-1;
        } else {
            n=a.size()/2;
            if(n>=m) return (n-m)*2-1;
            else return (m-n)*2;
        }
    }
}


int main()
{
    int n,q;
    cin >> n >> q;
    vector<int> a(n),b(q);
    for(int i=0; i<n; i++) {
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    for(int i=0; i<q; i++) {
        cin >> b[i];
        cout << glasovi(a,b[i]) << endl;
    }
    return 0;
}