#include <stdio.h>
#include <stdlib.h>
#include <math.h>

void swap(int* xp, int* yp)
{
    int temp = *xp;
    *xp = *yp;
    *yp = temp;
}

void bubbleSort(int arr[], int n)
{
    int i, j;
    for (i = 0; i < n - 1; i++)
        for (j = 0; j < n - i - 1; j++)
            if (arr[j] > arr[j + 1])
                swap(&arr[j], &arr[j + 1]);
}

int main()
{
    int n, q, med;
    scanf("%d", &n);
    scanf("%d", &q);
    int a[n];
    for(int i = 0; i<n; i++){
        scanf("%d", &a[i]);
    }
    int b[q];
    for(int i = 0; i<q; i++){
        scanf("%d", &b[i]);
    }

    bubbleSort(a, n);
    for (int i = 0; i<q; i++){
        med = n/2;
        int target = -1;
        for (int j = 0;j<n;j++){
            if (a[j]==b[i])
                target = j;
        }
        if(target!=-1){
            if(b[i]==a[med])
                printf("0\n");
            else
                printf("%d\n", abs((n-1-target)-(target-1)));
            }
        else{
            int c[n+1];
            for(int i = 0; i<n; i++){
                c[i] = a[i];
            }
            c[n] = b[i];
            bubbleSort(c,n+1);
            med = (n+1)/2;
            for (int j = 0;j<n+1;j++){
            if (c[j]==b[i])
                target = j;
            }
            if(b[i]==c[med])
                printf("0\n");
            else
                printf("%d\n", abs((n-target)-(target)));
            }
        }

    //printf("\nn: %d    q: %d\na: %d %d %d %d %d\nb: %d %d %d", n, q, a[0], a[1], a[2], a[3], a[4], b[0], b[1], b[2]);
    return 0;
}