#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, q;
    cin >> n >> q;
    int ubaceni [n];
    for (int i=0; i<n; i++)
        cin >> ubaceni[i];
    sort (ubaceni, ubaceni+n);
    int staramed;
    staramed=ubaceni[n/2];
    //cout << "stara medijana je" << staramed << endl;
    for (int i=0; i<q; i++)
    {
        int potrebno;
        int novamed;
        cin >> novamed;

        if (novamed>ubaceni[n-1])
        {
            if (n%2==0)
                potrebno=n;
            if (n%2==1)
                potrebno=n;
        }
        if (novamed<ubaceni[0])
        {
            if (n%2==0)
                potrebno=n+1;
            if (n%2==1)
                potrebno=n+1;
        }
        if (staramed==novamed)
        {
            potrebno=0;
        }

        if (novamed>=ubaceni[0] && novamed<=ubaceni[n-1] && novamed!=staramed)
        {
            int x;
            if (novamed<staramed)
            {
            for (int k=0; k<n/2; k++)
            {
                if (ubaceni[k]==novamed)
                {
                    potrebno=2*(n/2-k)-(n+1)%2;
                }
                if (k!=n-1 && ubaceni[k]<novamed && ubaceni[k+1]>novamed)
                {
                    potrebno=2*(n/2-k)-(n+1)%2;
                }
                if (ubaceni[k]>novamed)
                    k=n/2;
            }
            }


            if (novamed>staramed)
            {
            for (int k=n/2+1; k<n; k++)
            {
                if (ubaceni[k]==novamed)
                {
                    int j=k;
                    while (ubaceni[j]==ubaceni[j-1])
                    {
                        j--;
                    }
                    potrebno=2*(j-n/2)-n%2;

                }
                if (k!=n-1 && ubaceni[k]<novamed && ubaceni[k+1]>novamed)
                {
                    x=k+1;
                    potrebno=2*(x-n/2)-n%2;
                }
                if (ubaceni[k]>novamed)
                    k=n;
            }
            }
        }
        cout << potrebno << " ";
    }
}