#include <stdio.h>
#include <stdlib.h>
int main() {
    int n,q;
    scanf("%d%d",&n,&q);
    int *niz;
    int *medijane;
    niz=(int*)malloc((n+q)*sizeof(int));
    medijane=(int*)malloc(q*sizeof(int));
    for (int i=0;i<n;i++){
        scanf("%d",&niz[i]);
    }
    for (int i=0;i<q;i++){
        scanf("%d",&medijane[i]);
    }
for (int j=0;j<q;j++){
    for (int i=0;i<1000;i++){
        if (niz[(n+i)/2]==medijane[j]){
            printf("%d\n",i);
            break;
    }
}
}

    return 0;
}