#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    int n, q;
    vector<long long int> a, rez;
    cin >> n >> q;
    for(int i = 0; i < n; i++)
    {
        long long int x;
        cin >> x;
        a.push_back(x);
    }
    sort(a.begin(), a.end());
    int m;
    n % 2 == 0 ? m = n / 2 : m = (n - 1) / 2;
    for(int i = 0; i < q; i++)
    {
        long long int b;
        cin >> b;
        vector<long long int>::iterator it;
        it = find (a.begin(), a.end(), b);
        if(it != a.end())
        {
            int p = it - a.begin() - m;
            p < 0 ? p *= (-1) : p = p;
            rez.push_back(p);
            //cout << p << endl;
        }
        else
        {
            int k = 0;
            while(b > a[k] && k < n) k++;
            k < m ? rez.push_back(1 + n - 2 * k) : rez.push_back(k * 2 - n);
            //k < m ? cout << 1 + n - 2 * k << endl : cout << k * 2 - n << endl;
        }
    }
    for(int i = 0; i < q; i++) cout << rez[i] << endl;
    return 0;
}