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

using namespace std;

int binary(vector<long long int> a, long long int b)
{
    int i = 0;
    int j = a.size() - 1;
    while(i < j)
    {
        int k = (i + j) / 2;
        if(a[k] == b) return k;
        if(a[k] > b) i = k;
        if(a[k] < b) j = k;
    }
    return -1;
}

int main()
{
    ios_base::sync_with_stdio(false);
    int n, q;
    vector<long long int> a;
    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;
        int it = binary(a, b);
        if(it != -1)
        {
            int p = it - m;
            p < 0 ? p *= (-1) : p = p;
            cout << p << endl;
        }
        else
        {
            int k = 0;
            while(b[i] > a[k] && k < n) k++;
            k < m ? cout << 1 + n - 2 * k << endl : cout << k * 2 - n << endl;
        }
    }
    return 0;
}