// namestanje glasova.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <iterator>
#include <list>
using namespace std;

int getilist(list<int> l, int index)
{

    list<int>::iterator it;
    it = l.begin();
    for (int i = 0; i < index;i++)
    {
       // cout << endl;
     //   cout << index << endl;
     //   cout << *it<<endl;
        it++;
    }
    return *it;
}
int contains(list<int> niz, int num)
{
    list<int>::iterator it;
    it = niz.begin();
    for (int i = 0; i < niz.size(); i++)
    {
        if (num == *it)
        {
            return i+1;
        }
        it++;
    }
    return 0;
}
int howMany(list<int> niz, int num)
{
    int kolkoTacno = 0;
    int in = contains(niz, num);
   // cout << "num " << num << endl;
   // cout << "in " << in << endl;
   // cout << "niz.size " << niz.size() << endl;
    if (in)
    {
        //cout << "minimalno " << ((in - 1) * 2) << endl;
        
        kolkoTacno = ((in -1) * 2) - niz.size();
        if (kolkoTacno + (niz.size() % 2) == 0)
        {
            kolkoTacno = 0;
        }
        if(kolkoTacno<0)
        {
            niz.reverse();
            in = contains(niz, num);
            kolkoTacno = ((in -1 ) * 2) - niz.size()+1;
        }
        
    }
    else
    {
       // cout << "GRR"<<endl;
        niz.push_back(num);
        niz.sort();
        int in = contains(niz, num);
        kolkoTacno = ((in - 1) * 2) - niz.size();
        if (kolkoTacno + (niz.size() % 2) == 0)
        {
            kolkoTacno = 0;
        }
        if (kolkoTacno < 0)
        {
            niz.reverse();
            in = contains(niz, num);
            kolkoTacno = ((in - 1) * 2) - niz.size() + 1;
        }


        kolkoTacno += 1;

    }
    return kolkoTacno;
}
int main()
{
    int n; int b;
    cin >> n;
    cin >> b;
    list<int> niz;
    list<int> situacije;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        niz.push_back(a);
    }
    for (int i = 0; i < b; i++)
    {
        int a;
        cin >> a;
        situacije.push_back(a);
    }
    niz.sort();
    for (int i = 0; i < situacije.size(); i++)
    {
        cout << howMany(niz, getilist(situacije, i))<<endl;
    }


}