#include <bits/stdc++.h>
# define endl            '\n'
# define clr(x,a)        memset(x,a,sizeof(x))
# define vi              vector<int>
# define all(a)          a.begin(), a.end()
# define deb(x)          cout<<#x<<"=="<<x<<endl;
# define pb              push_back
# define sc              scanf
# define pr              printf
# define tc              int t; cin>>t; while(t--)
# define rev(s)          reverse(s.begin(),s.end())
# define linija          cout<<"___________\n";
# define sza(x)          (int)x.size()
using namespace std;
typedef long long ll;
const int mxN=200005, mxM=200005, mod=1e9+7, LOG=30;
template<typename T> T nzd(T a, T b){if(b==0) return a;else return nzd(b, a%b);}
template<typename T> T nzs(T a, T b){return(a*(b/nzd(a,b)));}
template<typename T> T stepenuj(T e, T n){T x=1,p=e;while(n){if(n&1)x=(x*p)%mod;p=(p*p)%mod;n>>=1;}return x;}
template<typename T> inline T na2(T x){return x*x;}
int n, q, a[mxN], b, im, d;
int bt_manji(){
   int l=1, r=n, mid, ret=0;
   while(l<=r){
      mid=(l+r)/2;
      if(b>=a[mid]){
         ret=max(mid, ret);
         l=mid+1;
      }
      else r=mid-1;
   }
   return ret;
}
int bt_veci(){
   int l=1, r=n, mid, ret=n+1;
   while(l<=r){
      mid=(l+r)/2;
      if(b>a[mid]){

         l=mid+1;
      }
      else{
         ret=min(mid, ret);
         r=mid-1;
      }
   }
   return ret;
}
int ap[mxN];
int checker(){
   for(int i=1; i<=n; i++) ap[i]=a[i];
   int np=n, imp=np/2+1;
   int ret=0;
//   sort(ap+1, ap+1+np);
   while(ap[imp]!=b){
      ret++;
      np++;
      imp=np/2+1;
      ap[np]=b;
      sort(ap+1, ap+1+np);
   }
   return ret;
}
int main(){
   sc("%d%d", &n, &q);
   for(int i=1; i<=n; i++) sc("%d", &a[i]);
   sort(a+1, a+1+n);
   im=n/2+1;

   int m=n%2;
   while(q--){
      sc("%d", &b);
//      cout<<checker()<<" ";
      if(b==a[im]) pr("0\n");
      else if(b>a[im]){
         if(m) pr("%d\n", (bt_veci()-im)*2-1);
         else pr("%d\n", (bt_veci()-im)*2);
      }
      else{
         if(m) pr("%d\n", (im-bt_manji())*2);
         else pr("%d\n", (im-bt_manji())*2-1);
      }
   }
	return 0;
}