#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,q,brojpapirica;
    int brojubacivana=0;
    cin>>n>>q;
    int a[n];
    int b[q];
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    for(int i=0;i<q;i++)
        cin>>b[i];
     for(int i=0;i<q;i++)
        {
            if(a[n/2+1]==b[i]){brojpapirica=b[i];cout <<brojubacivana;}
            else
            {
                while(b[i]!=a[n/2+1])
                {
                   n++;
                   a[n]=b[i];
                   brojubacivana++;
                }
                brojpapirica=b[i];
                cout << brojubacivana;
            }
        }
    return 0;
}