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

bool exist(int a[],int x, int n){
    int levi = 1, desni = n;
    int srednji;
    bool pronadjen=false;
    while (levi <= desni && pronadjen==false) 
    {
        srednji = (levi + desni) / 2; 
        if (x == a[srednji]) pronadjen = true; 
        else if (x < a[srednji])desni = srednji - 1; 
        else levi = srednji + 1; 
    }   
    if(pronadjen)return 1;
    else return 0;
}

int partition(int arr[], int start, int end)
{
 
    int pivot = arr[start];
 
    int count = 0;
    for (int i = start + 1; i <= end; i++) {
        if (arr[i] <= pivot)
            count++;
    }
 
    int pivotIndex = start + count;
    swap(arr[pivotIndex], arr[start]);
    int i = start, j = end;
 
    while (i < pivotIndex && j > pivotIndex) {
 
        while (arr[i] <= pivot) {
            i++;
        }
 
        while (arr[j] > pivot) {
            j--;
        }
 
        if (i < pivotIndex && j > pivotIndex) {
            swap(arr[i++], arr[j--]);
        }
    }
 
    return pivotIndex;
}
 
void quickSort(int arr[], int start, int end)
{
    if (start >= end)return;
    int p = partition(arr, start, end);
    quickSort(arr, start, p - 1);
    quickSort(arr, p + 1, end);
}

int binarySearch(int a[], int x,int n)
{
    int levi = 1, desni = n ;
    int srednji;
    bool pronadjen=false;
    while (levi <= desni && pronadjen==false) 
    {
        srednji = (levi + desni) / 2; 
        if (x == a[srednji]) pronadjen = true; 
        else if (x < a[srednji])desni = srednji - 1; 
        else levi = srednji + 1; 
    }   
    return srednji;
}
int rez(int a[], int n, int x){
    int m=(n/2)+1;
    if(a[m]==x)return 0;
    if(exist(a,x,n)){
        quickSort(a,0,n-1);
        return abs((2*(binarySearch(a,x,n)-1))-n);
    }else{
        a[n+1]=x;
        n=n+1;
        quickSort(a,0,n-1);
        return abs((2*(binarySearch(a,x,n)-1))-n)+1;
    }
    
    
    
    
}
int main()
{
 
    int n,q; cin>>n>>q;
    int a[1000000];
    int b[1000000];
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=0;i<q;i++)cin>>b[i];
    for(int i=0;i<q;i++)cout<<rez(a,n,b[i])<<endl;
    
    
}