#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int a, b, vv=0, mm=0, jed=0, med;
    int g[200000], m[200000];
    cin >> a >> b;
    for (int i = 0; i < a; i++)
    {
        cin >> g[i];
    }
    sort(g, g + a);
    for (int i = 0; i < b; i++)
    {
        cin >> med;
        for (int j = 0; j < a; j++)
        {
            if (g[j] == med) jed++;
            else if (g[j] > med) vv++;
            else if (g[j] < med) mm++;
        }
        if(jed == 0)
        {
            if (abs(mm - vv) == 0) m[i] = 1;
            else if (mm > vv) m[i] = abs(mm - vv);
            else if (mm < vv) m[i] = abs(mm - vv)+1;
            mm = 0; vv = 0;
        }
        else
        {
            if (abs(mm - vv) == 0) m[i] = 0;
            else if (mm > vv) 
            {
                m[i] = abs(mm - vv) - jed; if (m[i] < 0) m[i] = 0;
            }
            else if (mm < vv)
            {
                m[i] = abs(mm - vv) - jed+1; if (m[i] < 0) m[i] = 0;
            }
            mm = 0; vv = 0;jed = 0;
        }
    }
    for (int i = 0; i < b; i++) cout << m[i] << endl;
}