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

void uredi(int n, int* niz)
{
    int i, min, pom;
    for (i = 0; i < n - 1; i++)
    {
        min = i;
        for (int j = i + 1; j < n; j++)
            if (niz[i] < niz[min])
                min = j;
        pom = niz[i];
        niz[i] = niz[min];
        niz[min] = pom;
    }
}

int main()
{
    int n, q;
    int* a;
    int* b;
    
    int i, j, medijana, br;
    scanf("%d%d", &n, &q);
    
    a = (int*)malloc(n * sizeof(int));
    b = (int*)malloc(q * sizeof(int));

    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);

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

    medijana = a[n / 2];

    for (i = 0; i < q; i++)
    {
        br = 0;
        if (b[i] < medijana)
        {
            if (n % 2 == 0)
                br = 1;
            else
                br = 2;
            j = n/2 - 1;
            while (j>=0 && b[i] < a[j])
            {
                j--;
                br += 2;
            }
        }
        else if (b[i] > medijana)
        {
            if (n % 2 == 0)
                br = 2;
            else
                br = 1;
            j = n/2 + 1;
            while (j<n && b[i] > a[j])
            {
                j++;
                br += 2;
            }
        }
        printf("%d\n", br);
    }
    free(a);
    free(b);
    return 0;
}