import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner skener = new Scanner(System.in);
        int n = skener.nextInt();
        int q = skener.nextInt();
        ArrayList<Integer> glasovi = new ArrayList<>();
        ArrayList<Integer> glasovi1 = new ArrayList<>();
        int[] nizq = new int[q];
        int[] niza = new int[q];

        for (int i = 0; i < n; i++) {
            glasovi.add(skener.nextInt());
        }
        for (int i = 0; i < q; i++) {
            nizq[i] = skener.nextInt();
        }

        for (int i = 0; i < q; i++) {
            glasovi1.addAll(glasovi);
            if(!glasovi1.contains(nizq[i])){
                glasovi1.add(nizq[i]);
                niza[i]++;
            }
            sort(glasovi1, 0, glasovi1.size()-1);
            while (glasovi1.get(glasovi1.size()/2 ) != nizq[i]){
                if (glasovi1.get(glasovi1.size()/2 ) > nizq[i]) {
                    glasovi1.add(0, 1);
                    niza[i]++;
                }else {
                    glasovi1.add(glasovi1.get(glasovi1.size() - 1));
                    niza[i]++;
                }
            }

            glasovi1.removeAll(glasovi1);

        }

        for (int i = 0; i < niza.length; i++) {
            System.out.println(niza[i]);
        }
        
    }
    static int partition(ArrayList<Integer> arr, int a, int b)
    {
        int pivot = arr.get(b);
        int i = (a-1);
        for (int j=a; j<b; j++)
        {
            if (arr.get(j) <= pivot)
            {
                i++;

                int temp = arr.get(i);
                arr.set(i, arr.get(j));
                arr.set(j, temp);
            }
        }

        int temp = arr.get(i+1);
        arr.set(i+1, arr.get(b));
        arr.set(b, temp);

        return i+1;
    }

    static void sort(ArrayList<Integer> arr, int a, int b)
    {
        if (a < b)
        {
            int p = partition(arr, a, b);

            sort(arr, a, p-1);
            sort(arr, p+1, b);
        }
    }
}