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

using namespace std;

int main()
{
    int n, q;
    cin>>n>>q;
    int a[n], b[q];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<q;i++)
    {
        cin>>b[i];
    }

    sort(a, a+n);

    for (int s=0; s<q; s++)
    {
        int medijana = b[s];
        int i=0;
        while (i<n && a[i]<medijana) {
            i++;
        }
        int pre = i;
        //cout << "pre=" << pre << endl;


        int dodati = 0;
        if (medijana == a[pre])
        {
            //cout << "postoji=" << medijana << endl;
            int nakon = n - pre - 1;
            //cout << "nakon=" << nakon << endl;

            if (pre < nakon) {
                dodati = nakon - pre;
            }
            if (pre > nakon) {
                dodati = pre - nakon - 1;
            }

        } else {
            //cout << "ne-postoji=" << medijana << endl;
            int nakon = n - pre;
            //cout << "nakon=" << nakon << endl;

            if (pre < nakon) {
                dodati = nakon - pre + 1;
            }
            if (pre > nakon) {
                dodati = pre - nakon;
            }
        }

        cout << dodati << endl;

    }


    return 0;
}