#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ff(i,a,b) for(int (i) = (a); (i) <= (b); ++(i))
#define fb(i,a,b) for(int (i) = (a); (i) >= (b); --(i))
#define mod 998244353
#define xx first
#define yy second
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ll long long
#define pii pair<int,int>


using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;/// find_by_order(x)(x+1th) , order_of_key() (strictly less)
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());





int n,m;
int niz[200005];

int main()
{

    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n >> m;
    ff(i,1,n)cin >> niz[i];
    sort(niz+1,niz+n+1);
    while(m--){
        int x;
        cin >> x;
        int manji=0;
        if(niz[1]<x){
            int l = 1;
            int r = n;
            while(l<r){
                int mid = (l+r+1)/2;
                if(niz[mid]<x){
                    l = mid;
                }
                else r = mid - 1;
            }
            manji = l;
        }
        int veci = 0;
        if(niz[n]>x){
            int l = 1;
            int r = n;
            while(l < r){
                int mid = (l+r)/2;
                if(niz[mid]>x)r = mid;
                else l = mid + 1;
            }
            veci = n-l+1;
        }
        int jed = n-manji-veci;
        int gr = max(manji-veci,veci-manji-2);
        cout << max(0,gr-jed) << "\n";
    }
    return 0;
}