#include <bits/stdc++.h>
using namespace std;
int main()
{
    int p,q;
    cin >> p >> q;
    int a[p];
    for ( int i = 0 ; i < p ; i++ )
        cin >> a[i];
    while(q--)
    {
        int x;
        cin >> x;
        int n = 0;
        int m = 0;
        for ( int i = 0 ; i < p ; i++ )
        {
            if ( a[i] < x)
                n++;
            else if ( a[i] > x )
                m++;
        }
        bool b = 0;
        for ( int i = 0 ; i < p ; i++ )
        {
            if ( a[i] == x)
            {
                if ( b == 1)
                {
                    if ( m<=n)
                        m++;
                    else
                        n++;
                }
                b = 1;
            }
        }
        if ( m >= n )
        {
            if ( b == 1)
                cout << m - n << endl;
            else
                cout << m - n + 1 << endl;
        }
        else
        {
            if ( b == 1)
                cout << n - m - 1<< endl;
            else
                cout << n - m << endl;
        }
    }
	return 0;
}