#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int binarySearchLow(const vector<int>& A,int b){
    int left=0,right=A.size()-1,br=0;
    while(left<=right){
        int mid=(left+right)/2;
        if(A[mid]<b){
            br=mid+1;
            left=mid+1;
        }
        else
            right=mid-1;
    }
    return br;
}
int binarySearchHigh(const vector<int>& A,int b){
    int left=0,right=A.size()-1,br=A.size();
    while(left<=right){
        int mid=(left+right)/2;
        if(A[mid]>b){
            br=mid;
            right=mid-1;;
        }
        else
            left=mid+1;
    }
    return A.size()-br;
}
int minGlasova(const vector<int>& A,int b){
    int low=binarySearchLow(A,b),high=binarySearchHigh(A,b);
    int eq=A.size()-low-high,brojGlasova=0;
    if(low>high) brojGlasova=low-high-1;
    else if(low<high) brojGlasova=high-low+1;
    return brojGlasova-eq+1;
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int N,Q;
    cin>>N>>Q;
    vector<int> A(N),B(Q);
    for(int i=0;i<N;i++)
        cin>>A[i];
    sort(A.begin(),A.end());
    for(int i=0;i<Q;i++){
        cin>>B[i];
        cout<<minGlasova(A,B[i])<<endl;
    }
	return 0;
}