#include <bits/stdc++.h>
  #include <iostream>
  using namespace std;
  
  int main() {
    long long n, m;
    cin >> n >> m;
    long long a[n], b[m];
    int h=0;
    for(int i=0;i<n;i++){
      cin>>a[i];
    }
    for(int i=0;i<m;i++)
      cin>>b[i];
    if(n%2==0)
    {
      h=n/2;
    }
    else
      h=(n/2)+1;
    int k = n / sizeof(a[0]);
    sort(a,a+k);
    for(int i=0;i<m;i++)
      {
        if(a[h-1]==b[i])
        {
          cout<<0<<endl;
        }
        else
        {
          int j = 0;
          while (j < n)
            {
              if (a[j] != b[i]) {
                j++;
                }
              else
                break;
            }
          j++;
          if(j>=n)
            j=n+h;
          j=j-h;
          cout<<abs(j)<<endl;
        }
      }
  }