#include <bits/stdc++.h>
using namespace std;

int find(int A[], int n, int x){
      int i = 0;
      int k = n - 1;

      int j;
      while(i < k){
            j = (i + k) / 2;
            if(A[j] == x)
                  return j;
            if(A[j] > x)
                  k = j - 1;
            else if(A[j] < x)
                  i = j + 1;
      }

      return i;
}

int main(){
      int n, q;
      scanf("%d", &n);
      scanf("%d", &q);

      int A[n], B[q];

      for(int i = 0;i < n;i++){
            scanf("%d", &A[i]);
      }

      for(int i = 0;i < q;i++){
            scanf("%d", &B[i]);
      }

      sort(A, A + n);
      int m = A[n/2];
      int br, j;

      for(int i = 0;i < q;i++){
            if(m == B[i])
                  printf("0\n");
            else{
                  j = find(A, n, B[i]);

                  br = n + 1;
                  if(A[j] == B[i]){
                        br -= 2 + 2*j;
                        if(br < 0){
                              br = -br-1;
                        }
                  }
                  else if(A[j] < B[i]){
                        br -= 2*(j + 1);
                        if(br < 0){
                              br = -br+1;
                        }
                  }
                  else{
                        br -= 2*j;
                        if(br < 0){
                              br = -br+1;
                        }
                  }

                  printf("%d\n", br);
            }
      }

      return 0;
}