#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <time.h>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <iterator>
#include <windows.h>
#include <cmath>

#define INF 0x3f3f3f3f

using namespace std;
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
using std::ifstream;
using std::istringstream;
using std::ostringstream;
using std::string;
using std::stringstream;
using std::vector;

int calculateMedian(vector<int> list)
{
    if (list.size() % 2 != 0)
        return list[round(list.size() / 2)];
    return list[list.size() / 2 + 1];
}

int calculateVotes(vector<int> glasovi, int medijana)
{
    // check if there is no need to add anything
    if (medijana == calculateMedian(glasovi))
    {
        return 0;
    }

    if (medijana > glasovi.back() || medijana < glasovi.front())
    {
        return glasovi.size();
    }

    int count1 = INF;
    int count2 = INF;
    int count3 = INF;

    for (int i = 0; i < glasovi.size() - 1; i++)
    {
        if ((int)round((glasovi[i] + glasovi[i + 1]) / 2.0) == medijana)
        {
            (i + 1) > glasovi.size() / 2.0 ? count1 = i - (glasovi.size() - i - 2) : count1 = -(i - (glasovi.size() - i - 2));
        }
    }

    for (int i = 0; i < glasovi.size(); i++)
    {
        if (glasovi[i] == medijana)
        {
            (i + 1) > glasovi.size() / 2.0 ? count2 = i - (glasovi.size() - i) : count2 = -(i - (glasovi.size() - i));
        }
    }
    for (int i = 1; i < glasovi.size() - 1; i++)
    {
        int temp = 2 * medijana - glasovi[i];
        if (temp > glasovi[i - 1] && temp < glasovi[i + 1])
        {
            (i + 1) > glasovi.size() / 2.0 ? count3 = i - (glasovi.size() - i - 2) : count3 = -(i - (glasovi.size() - i - 2));
        }
    }

    return min(count1, min(count2, count3));
}

int main(void)
{
    int N, Q;
    vector<int> glasovi, situacije;

    // input
    cin >> N >> Q;
    for (int i = 0; i < N; i++)
    {
        int temp;
        cin >> temp;
        glasovi.push_back(temp);
    }
    for (int i = 0; i < Q; i++)
    {
        int temp;
        cin >> temp;
        situacije.push_back(temp);
    }
    // end of input

    sort(glasovi.begin(), glasovi.end());

    // output
    for (auto x : situacije)
    {
        cout << calculateVotes(glasovi, x) << endl;
    }
    // end of output

    return 0;
}