#include<bits/stdc++.h>
using namespace std;
int bin_search (int arr[], int num, int tgt)  {  
    int beg = 0, end = num - 1;    
    while (beg <= end)  
    {   
        int mid = (beg + end) /2;         
        if (tgt == arr[mid])  
        {  
            return mid;   
        }         
  
        else if (tgt < arr[mid])  
        {  
            end = mid - 1;  
        }         
          
        else {  
            beg = mid + 1;  
        }  
    }  
  
    return -1;  
} 



int main(int argc, char** argv){
	int q, n, a[1001], b[1001], pom [1001], m = 0, t, c = 0;
	cin>>n>>q;
	for(int i = 0; i < n; i++){
		cin>>a[i];
		pom[i] = a[i];
	}
	for(int i = 0; i < q; i++){
		cin>>b[i];
	}
	sort(a, a + n);
	
	for(int con = 0; con < q; con++){
		t = bin_search(a, n, b[con]);
		if(t == -1){
			a[n] = b[con];
			sort(a, a + n + 1);
			n++;
			//m++;
			c++;
		}
		t = bin_search(a, n, b[con]);
		
		if(t == n / 2){
			cout<<0<<endl;
			continue;
		}
		
		m = abs( m + (2 * t + 1 - n));
		
		cout<<m<<endl;
		m = 0;
		
		
		if(c == 1){
			n--;
			c--;
		}
		
		for(int i = 0; i < n; i++){
			a[i] = pom[i];
		}
	}
	return 0;
}