import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Test {
	static int scenario(int[]a, int x)
	{
		int pocetni = 0;
		if(!IntStream.of(a).anyMatch(y -> y == x)) {
			a = dodaj(a, x, a.length);
			pocetni = 1;
		}
		int pozicija = Arrays.binarySearch(a, x);
		int desni = a.length - (pozicija + 1);
		int levi = pozicija;
		if(desni < levi)
			return (levi - desni - 1) + pocetni;
		else
			return(levi - desni) + pocetni;
	}
	static int[] dodaj(int[] a, int x, int n)
	{
		int[]b= new int[n + 1];
		int i = 0;
		int j = 0;
		boolean ubacen = false;
		while(i < n)
		{
			if(!ubacen && a[i] > x) {
				b[j] = x;
				j++;
				ubacen = true;
			}
			b[j++] = a[i++];
		}
		if(!ubacen)
			b[n] = x;
		return b;
	}
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		int[] a = new int[n];
		int[] b = new int[m];
		for (int i = 0; i < n; i++) 
			a[i] = in.nextInt();
		for (int i = 0; i < m; i++)
			b[i] = in.nextInt();
		Arrays.sort(a);
		for (int i = 0; i < m; i++) {
			System.out.println(scenario(a, b[i]));
		}
		in.close();
	}

}