#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,q;
    cin>>n>>q;
    int a[n+1],b[q],c[n+1];
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<q;i++)cin>>b[i];
    sort(a,a+n);
    for(int i=0;i<n;i++)c[i]=a[i];
    for(int i=0;i<q;i++)
    {
        int j;
        for(j=0;j<n;j++)
        {
            if(b[i]==a[j])
                break;
        }
        if(j==n)
        {
            a[n]=b[i];
            n++;
            sort(a,a+n);
            for(j=0;j<n;j++)
            {
                if(b[i]==a[j])
                    break;
            }
            if(j==n/2) cout<<1<<"\n";
            else if(j<n-j) cout<<n-2*j<<"\n";
            else cout<<2*j-n+1<<"\n";
            n--;
            for(int k=0;k<n;k++)a[k]=c[k];
        }
        else
        {
            if(j==n/2) cout<<0<<"\n";
            else if(j<n-j) cout<<n-2*j-1<<"\n";
            else cout<<2*j-n<<"\n";
        }
    }
}