You are given two arrays of integers a and b. For each element of the second array b_{j} you should find the number of elements in array a that are less than or equal to the value b_{j}.


-----Input-----

The first line contains two integers n, m (1 ≤ n, m ≤ 2·10^5) — the sizes of arrays a and b.

The second line contains n integers — the elements of array a ( - 10^9 ≤ a_{i} ≤ 10^9).

The third line contains m integers — the elements of array b ( - 10^9 ≤ b_{j} ≤ 10^9).


-----Output-----

Print m integers, separated by spaces: the j-th of which is equal to the number of such elements in array a that are less than or equal to the value b_{j}.


-----Examples-----
Input
5 4
1 3 5 7 9
6 4 2 8

Output
3 2 1 4

Input
5 5
1 2 1 2 5
3 1 4 1 5

Output
4 2 4 2 5

Source: codeforces | Difficulty: EASY
Tags: Data structures

Sorting

Amortized analysis


Solutions:
import bisect
import os
import gc
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	s = set()
	for p in range(2, n + 1):
		if prime[p]:
			s.add(p)
	return s

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	(n, m) = ain()
	a = ain()
	b = ain()
	i = 0
	j = 0
	d = deque()
	x = b.copy()
	a.sort()
	b.sort()
	count = 0
	while i < n and j < m:
		if b[j] > a[i]:
			count += 1
			i += 1
		elif b[j] == a[i]:
			count += 1
			i += 1
		elif b[j] < a[i]:
			d.append(count)
			j += 1
	while j < m:
		d.append(count)
		j += 1
	dic = {}
	for i in range(m):
		dic[b[i]] = d[i]
	for i in range(m):
		b[i] = dic[x[i]]
	print(*b)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if os.getcwd() == 'D:\\code':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


(n, m) = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
for i in range(m):
	b[i] = (b[i], i)
b = sorted(b)
ans = [0 for i in range(m)]
p = 0
for i in range(m):
	while p < n and a[p] <= b[i][0]:
		p += 1
	ans[b[i][1]] = p
for i in range(m):
	print(ans[i], end=' ' if i != m - 1 else '\n')


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
from sys import stdin, stdout
from collections import Counter
from math import ceil
from bisect import bisect_left
from bisect import bisect_right
import math
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def lessThanX(a, x):
	i = bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def BinarySearch(a, x):
	i = bisect_right(a, x)
	if i != len(a) + 1 and a[i - 1] == x:
		return i - 1
	else:
		return -1

def main():
	(n, m) = ei()
	first = ai()
	first.sort()
	second = ai()
	for i in second:
		z = BinarySearch(first, i)
		if z != -1:
			print(z + 1, end=' ')
		else:
			p = lessThanX(first, i)
			if p == -1:
				print(0, end=' ')
			else:
				print(p + 1, end=' ')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
ip = lambda : int(sys.stdin.readline().rstrip('\r\n'))
ai = lambda : list(map(int, sys.stdin.readline().split()))
ei = lambda : map(int, sys.stdin.readline().split())
main()


import sys
import bisect
(t, r) = map(int, sys.stdin.readline().split())
(a, b) = (sorted([int(x) for x in sys.stdin.readline().split()]), [int(x) for x in sys.stdin.readline().split()])
R = sorted(a)
out = []
for x in b:
	out.append(bisect.bisect(R, x))
print(*out)


(n, m) = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))

def binary_search(e, start, end):
	mid = (start + end) // 2
	if start == n - 1 and a[start] <= e:
		return start + 1
	elif end == 0 and a[end] > e:
		return 0
	elif start == end:
		return start
	elif e < a[mid]:
		return binary_search(e, start, mid)
	elif a[mid] <= e:
		return binary_search(e, mid + 1, end)
print(' '.join([str(binary_search(i, 0, n - 1)) for i in b]))


import bisect
(n, m) = map(int, input().strip().split())
a = sorted(map(int, input().strip().split()))
b = list(map(int, input().strip().split()))
answer = []
for i in b:
	answer.append(bisect.bisect_right(a, i))
print(*answer)


from sys import stdin

def comparar(lista1, lista2):
	lista1.sort()
	for i in range(len(lista2)):
		lista2[i].append(i)
	lista2 = sorted(lista2, key=lambda lista2: lista2[0])
	cont1 = 0
	while cont1 < len(lista2):
		if lista2[cont1][0] >= lista1[-1]:
			lista2[cont1].append(len(lista1))
		elif cont1 == 0:
			for i in range(len(lista1)):
				if lista1[i] > lista2[cont1][0]:
					lista2[cont1].append(i)
					break
		elif lista2[cont1][0] == lista2[cont1 - 1][0]:
			lista2[cont1].append(lista2[cont1 - 1][2])
		else:
			for i in range(lista2[cont1 - 1][2], len(lista1)):
				if lista1[i] > lista2[cont1][0]:
					lista2[cont1].append(i)
					break
		cont1 += 1
	lista2 = sorted(lista2, key=lambda lista2: lista2[1])
	rta = ''
	for i in range(len(lista2)):
		if i != len(lista2) - 1:
			rta += str(lista2[i][2]) + ' '
		else:
			rta += str(lista2[i][2])
	return rta

def main():
	(n1, n2) = stdin.readline().strip().split()
	arr1 = [int(x) for x in stdin.readline().strip().split()]
	arr2 = [[int(x)] for x in stdin.readline().strip().split()]
	print(comparar(arr1, arr2))
main()


def rightmost(arr, target):
	lo = 0
	hi = len(arr) - 1
	while lo <= hi:
		mid = (hi + lo) // 2
		if arr[mid] > target:
			hi = mid - 1
		else:
			lo = mid + 1
	return hi
(_, _) = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
a.sort()
b
res = []
for elem in b:
	ans = rightmost(a, elem)
	res.append(str(ans + 1))
print(' '.join(res))


(m, n) = input().split(' ')
m = int(m)
n = int(n)
a = [int(x) for x in input().split(' ')]
b = [int(x) for x in input().split(' ')]
a.sort()
for i in b:
	r = 0
	l = m - 1
	while r <= l:
		mid = l + (r - l) // 2
		if a[mid] <= i:
			r = mid + 1
		else:
			l = mid - 1
	if a[mid] <= i:
		print(mid + 1)
	else:
		print(mid)


(n, m) = map(int, input().split())
a = sorted([int(s) for s in input().split()])
b = [int(s) for s in input().split()]
output = []
for i in range(len(b)):
	lo = 0
	hi = n - 1
	ans = 0
	while lo <= hi:
		MiddleNum = lo + (hi - lo) // 2
		if a[MiddleNum] <= b[i]:
			lo = MiddleNum + 1
			ans = MiddleNum + 1
		else:
			hi = MiddleNum - 1
	output.append(ans)
print(' '.join((str(i) for i in output)))


(na, nb) = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
res = []
from bisect import bisect_right
for bj in b:
	i = bisect_right(a, bj) - 1
	if i == na:
		res.apend(na)
	elif i == -1:
		res.append(0)
	elif a[i] <= bj:
		res.append(i + 1)
print(*res)


import bisect
(N, M) = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
B = list(map(int, input().split()))
ans = []
for b in B:
	ind = bisect.bisect_right(A, b)
	ans.append(ind)
print(' '.join(map(str, ans)))


from sys import stdin, stdout
(n, k) = [int(x) for x in stdin.readline().split()]
li1 = [int(x) for x in stdin.readline().split()]
li2 = [int(x) for x in stdin.readline().split()]
li1.sort()
for key in li2:
	l = 0
	h = n
	while h - l > 1:
		mid = (l + h) // 2
		if li1[mid] > key:
			h = mid
		else:
			l = mid
	if l == 0:
		if key >= li1[l]:
			print(l + 1, end=' ')
		else:
			print(l, end=' ')
	else:
		print(l + 1, end=' ')


from bisect import bisect_right

def ans(a, b, n, m):
	ans = []
	a.sort()
	for i in range(m):
		pos = bisect_right(a, b[i])
		ans.append(pos)
	return ans
(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
result = ans(a, b, n, m)
print(*result)


(n, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
resb = dict()
sa = sorted(a)
sb = sorted(b)
i = 0
j = 0
while j < len(sb):
	while i < len(sa) and sa[i] <= sb[j]:
		i += 1
	resb[sb[j]] = i
	j += 1
for i in b:
	print(resb[i], end=' ')


input()
a = list(map(int, input().split()))
b = enumerate(list(map(int, input().split())))
a = sorted(a)
b = sorted(b, key=lambda elem: elem[1])
result = []
for i in range(len(b)):
	result.append(0)
lastb = 0
cura = 0
for curb in b:
	val = lastb
	if cura < len(a):
		while a[cura] <= curb[1]:
			cura += 1
			val += 1
			if cura >= len(a):
				break
	result[curb[0]] = val
	lastb = val
r = ''
for i in range(len(result)):
	r += str(result[i]) + ' '
print(r)


(a, b) = map(int, input().split())
s = sorted(list(map(int, input().split())))
z = list(map(int, input().split()))

def f(s, x):
	hi = len(s) - 1
	lo = 0
	ans = 0
	while lo <= hi:
		mid = (hi + lo) // 2
		if s[mid] <= x:
			ans = mid + 1
			lo = mid + 1
		else:
			hi = mid - 1
	return ans
for n in z:
	print(f(s, n), end=' ')


from bisect import bisect_right
import sys

class Scanner:

	def __init__(self):
		self.current_tokens = []

	def remaining_tokens(self):
		return len(self.current_tokens)

	def nextline(self):
		assert self.remaining_tokens() == 0, 'Reading next line with remaining tokens'
		return input()

	def nexttokens(self):
		return self.nextline().split()

	def nexttoken(self):
		if len(self.current_tokens) == 0:
			self.current_tokens = self.nexttokens()
		assert self.remaining_tokens() > 0, 'Not enough tokens to parse.'
		return self.current_tokens.pop(0)

	def nextints(self, n=-1):
		if n == -1:
			return list(map(int, self.nexttokens()))
		else:
			return [self.nextint() for i in range(n)]

	def nextint(self):
		return int(self.nexttoken())

def quit():
	sys.exit(0)
stdin = Scanner()
nextint = stdin.nextint
nextints = stdin.nextints
nextline = stdin.nextline
(m, n) = nextints()
a = nextints()
b = nextints()
res = []
a = sorted(a)
for i in b:
	res.append(str(bisect_right(a, i)))
print(' '.join(res))


import bisect
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = sorted(a)
for i in range(m):
	print(bisect.bisect(a, b[i]), end=' ')


from bisect import bisect_right
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
ans = []
for x in b:
	index = bisect_right(a, x)
	ans.append(index)
print(*ans)


(m, n) = map(int, input().split())
y = sorted(list(map(int, input().split())))
z = list(map(int, input().split()))
for i in range(n):
	ans = 0
	lo = 0
	hi = m - 1
	while lo <= hi:
		mid = int(lo + (hi - lo) / 2)
		if y[mid] <= z[i]:
			ans = mid + 1
			lo = mid + 1
		else:
			hi = mid - 1
	print(str(ans) + ' ', end='')


from bisect import *
(n, m) = map(int, input().split())
l = [int(i) for i in input().split()]
l.sort()
m = [int(i) for i in input().split()]
for i in m:
	c = bisect_right(l, i)
	print(c, end=' ')


import sys
from bisect import bisect_left, bisect_right

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().strip('\n')
(n, m) = get_ints()
a = get_array()
b = get_array()
k = []
a.sort()
for i in b:
	ans1 = bisect_left(a, i)
	ans2 = bisect_right(a, i)
	print(max(ans1, ans2), end=' ')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(enumerate(map(int, input().split())))
a.sort(reverse=True)
b.sort(key=lambda e: e[1], reverse=True)
arr = [None for _ in range(m)]
i = 0
for e in b:
	while e[1] < a[i] if i < n else False:
		i += 1
	arr[e[0]] = str(n - i)
print(' '.join(arr))


import bisect
input().split()
a = list(map(int, input().split()))
a.sort()
b = list(map(int, input().split()))
for item in b:
	print(bisect.bisect_right(a, item), end=' ')


from sys import stdin
ip = stdin.readline
(n, m) = list(map(int, ip().split()))
N = list(map(int, ip().split()))
M = list(map(int, ip().split()))
N.sort()
for x in M:
	(l, r, ans) = (0, n - 1, 0)
	while l <= r:
		m = int((l + r) / 2)
		if x >= N[m]:
			l = m + 1
			ans = m
		else:
			r = m - 1
	if N[ans] <= x:
		print(ans + 1, end=' ')
	else:
		print(ans, end=' ')


def b_s(arr, target):
	start = 0
	end = len(arr) - 1
	mid = (start + end) // 2
	while start <= end:
		if arr[mid] > target:
			end = mid - 1
			mid = (start + end) // 2
		else:
			start = mid + 1
			mid = (start + end) // 2
	return mid + 1
(n, m) = [int(num) for num in input().split()]
A = [int(nu) for nu in input().split()]
B = [int(nu) for nu in input().split()]
A.sort()
for (i, j) in enumerate(B):
	if i < m - 1:
		if j < A[0]:
			print(0, end=' ')
		elif j >= A[-1]:
			print(n, end=' ')
		else:
			print(b_s(A, j), end=' ')
	elif j < A[0]:
		print(0, end='')
	elif j >= A[-1]:
		print(n, end='')
	else:
		print(b_s(A, j), end='')


x = input().split()
y = [int(p) for p in input().split()]
z = [int(p) for p in input().split()]
y = sorted(y)
import bisect
for i in z:
	print(bisect.bisect_right(y, i, 0, len(y)), end=' ')


def busca(array, num, ini, fim):
	meio = (ini + fim) // 2
	if array[meio] <= num:
		if array[meio + 1] > num:
			return meio + 1
		return busca(array, num, meio, fim)
	else:
		if array[meio - 1] < num:
			return meio
		return busca(array, num, ini, meio)
(n, m) = [int(x) for x in input().split()]
a1 = [int(x) for x in input().split()]
a1.sort()
for i in input().split():
	r = 0
	e = int(i)
	if e < a1[0]:
		r = 0
	elif e >= a1[-1]:
		r = n
	else:
		r = busca(a1, e, 0, n)
	print(r, end=' ')


import bisect
R = lambda : list(map(int, input().split()))
(n, m) = R()
a = sorted(R())
b = R()
for x in b:
	print(f'{bisect.bisect(a, x)} ', end='')


def binary(a, target, l, r):
	pos = n
	while l <= r:
		mid = l + (r - l) // 2
		val = a[mid]
		if target <= val:
			pos = mid
			r = mid - 1
		else:
			l = mid + 1
	return pos
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for i in range(m):
	ind = binary(a, b[i] + 1, 0, n - 1)
	print(ind, end=' ')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(b)
a.sort()
b.sort()
d = {}
i = 0
for j in b:
	while i < n and a[i] <= j:
		i += 1
	d[j] = i
for i in c:
	print(d[i], end=' ')


(n, m) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a.sort()
a.append(max(b) + 1)
num = {}
c = sorted(b)
j = 0
i = 0
while j < m and i < n + 1:
	if a[i] > c[j]:
		num[c[j]] = i
		j += 1
	else:
		i += 1
for i in range(m):
	print(num[b[i]], end=' ')


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from bisect import *
(n, m) = f()
la = sorted(il())
lb = il()
for i in lb:
	print(bisect_right(la, i), end=' ')


import bisect
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
res = []
for i in range(m):
	res.append(bisect.bisect_right(a, b[i]))
print(' '.join(map(str, res)))


ab = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
bcop = sorted(b.copy())
bdic = {}
a = sorted(a)
ap = 0
bp = 0
while bp < ab[1] and ap < ab[0]:
	if bcop[bp] < a[0]:
		bdic[bcop[bp]] = 0
		bp += 1
	elif bcop[bp] >= a[ab[0] - 1]:
		bdic[bcop[bp]] = ab[0]
		bp += 1
	elif a[ap] <= bcop[bp]:
		ap += 1
	else:
		bdic[bcop[bp]] = ap
		bp += 1
saida = ''
for i in range(ab[1]):
	saida += '%d ' % bdic[b[i]]
print(saida.strip())


from bisect import bisect
(n, m) = map(int, input().split())
l = list(map(int, input().split()))
p = list(map(int, input().split()))
o = []
l.sort()
for u in p:
	d = bisect(l, u)
	o.append(d)
for t in o:
	print(t, end=' ')
print('')


def func(a, s):
	l = 0
	r = len(a) - 1
	f = 0
	m = 0
	while l <= r:
		m = int((l + r) / 2)
		if a[m] > s:
			r = m - 1
		else:
			l = m + 1
	return l
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
ans = []
c = 0
for i in range(0, m):
	print(func(a, b[i]), end=' ')


(size, size1) = map(int, input().split())
n = list(map(int, input().split()))
m = list(map(int, input().split()))
n.sort()
for x in range(len(m)):
	low = 0
	high = size - 1
	ans = 0
	while low <= high:
		mid = (low + high) // 2
		if n[mid] <= m[x]:
			ans = mid + 1
			low = mid + 1
		else:
			high = mid - 1
	print(ans, end=' ')


import bisect
cin = lambda : map(int, input().split())

def solve():
	(n, m) = cin()
	a = cin()
	b = cin()
	a = sorted(a)
	li = [bisect.bisect_right(a, i) for i in b]
	print(' '.join(map(str, li)))
solve()


import bisect
read = lambda : map(int, input().split())
(n, m) = read()
a = sorted(list(read()))
b = list(read())
ans = []
for i in range(m):
	ans.append(bisect.bisect_right(a, b[i]))
print(' '.join(map(str, ans)))


def bin_search(a, x):
	n = len(a)
	left = -1
	right = n
	while right - left > 1:
		middle = (left + right) // 2
		if a[middle] > x:
			right = middle
		else:
			left = middle
	if right == n and a[right - 1] >= x:
		return right
	if right == 1 and a[0] > x:
		return 0
	return right
R1 = lambda : list(map(int, input().split()))
R2 = lambda : int(input())
(n, m) = R1()
(a, b) = (R1(), R1())
res = ''
a.sort()
for x in b:
	res += str(bin_search(a, x)) + ' '
print(res, end='')


(n, m) = list(map(int, input().split(' ')))
a = list(sorted(map(int, input().split(' '))))
b = list(map(int, input().split(' ')))
c = sorted(set(b))
l = {}
j = 0
for i in c:
	while j < n and a[j] <= i:
		j += 1
	l[i] = j
s = []
for i in b:
	s.append(l[i])
print(' '.join(map(str, s)))


(n, m) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a.sort()
c = []
for i in range(m):
	l = -1
	r = len(a)
	while r > l + 1:
		k = (l + r) // 2
		if a[k] <= b[i]:
			l = k
		else:
			r = k
	c.append(l + 1)
message = ' '.join([str(j) for j in c])
print(message)


import sys
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
num = 0
for i in range(m):
	b[i] = (b[i], i)
b.sort()
a.sort()
ans = [0 for i in range(m)]
i = 0
j = 0
while j < m:
	if i == n or a[i] > b[j][0]:
		ans[b[j][1]] = num
		j += 1
	else:
		num += 1
		i += 1
for num in ans:
	print(num, end=' ')


from bisect import bisect
(n, m) = list(map(int, input().rstrip().split()))
a = list(map(int, input().rstrip().split()))
a.sort()
b = list(map(int, input().rstrip().split()))
for x in b:
	print(bisect(a, x), end=' ')


import sys
from bisect import bisect_right
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for i in b:
	sys.stdout.write(f'{bisect_right(a, i)} ')


from bisect import bisect_right
(n, m) = map(int, input().split())
a = sorted(map(int, input().split()))
answer = []
for b in map(int, input().split()):
	answer.append(bisect_right(a, b))
print(*answer)


def f(x, k):
	if x[0] > k:
		return 0
	(lo, hi) = (0, len(x) - 1)
	m = 0
	while lo < hi - 1:
		m = (lo + hi) // 2
		if x[m] <= k:
			lo = m
		else:
			hi = m - 1
	return hi + 1 if x[hi] <= k else lo + 1
(n, m) = list(map(int, input().split()))
x = sorted(map(int, input().split()))
y = list(map(int, input().split()))
sol = [0] * m
for i in range(m):
	sol[i] = f(x, y[i])
print(' '.join(map(str, sol)))


def bsearch(lis, num):
	n = len(lis)
	first = 0
	last = n - 1
	while first <= last:
		mid = (first + last) // 2
		if lis[mid] <= num < lis[mid + 1]:
			return mid
		elif lis[mid] > num:
			last = mid - 1
		else:
			first = mid + 1
(n, m) = map(int, input().split())
nums = list(map(int, input().split()))
nums = sorted(nums)
querys = list(map(int, input().split()))
for query in querys:
	if query >= nums[n - 1]:
		print(n, end=' ')
	elif query < nums[0]:
		print(0, end=' ')
	else:
		ind = bsearch(nums, query)
		print(ind + 1, end=' ')


from bisect import bisect_right
s = str(input())
z = lambda : map(int, input().split())
k = z()
mas1 = list(k)
z = lambda : map(int, input().split())
k = z()
mas2 = list(k)
mas1 = sorted(mas1)
for i in mas2:
	print(bisect_right(mas1, i), end=' ')


import sys
import random
from math import log2, log, ceil
input = sys.stdin.readline

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, size, link):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().split()))
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
(n, m) = int_array()
a = int_array()
b = int_array()
for i in range(m):
	b[i] = (b[i], i)
a.sort()
b.sort()
i = j = 0
ans = []
while i < n and j < m:
	if a[i] <= b[j][0]:
		i += 1
	else:
		ans.append((b[j][1], i))
		j += 1
while len(ans) < m:
	ans.append((b[j][1], i))
	j = j + 1
ans.sort()
answer = [ans[i][1] for i in range(m)]
print(*answer)


def binary_search(A, a, n):
	hi = n - 1
	lo = 0
	ans = -1
	while lo <= hi:
		mid = lo + hi >> 1
		if A[mid] <= a:
			ans = mid
			lo = mid + 1
		else:
			hi = mid - 1
	return ans
(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.sort()
for i in range(m):
	q = binary_search(A, B[i], n)
	if q == -1:
		print(0, end=' ')
	else:
		print(q + 1, end=' ')


from sys import stdin

def mergesort(lista, lon):
	if len(lista) == 1:
		return lista
	else:
		mid = lon // 2
		x = mergesort(lista[:mid], lon - mid) + [float('inf')]
		y = mergesort(lista[mid:], lon - mid) + [float('inf')]
		(lo, hi) = (0, 0)
		tot = []
		while lo < len(x) - 1 or hi < len(y) - 1:
			if x[lo] <= y[hi]:
				tot.append(x[lo])
				lo += 1
			else:
				tot.append(y[hi])
				hi += 1
		return tot

def bina(num, lo, hi):
	global lo1, L1
	while lo <= hi:
		mid = lo + (hi - lo) // 2
		if L1[mid] > num:
			hi = mid - 1
		elif L1[mid] <= num:
			lo = mid + 1
	return lo

def main():
	global lo1, L1
	(lo1, lo2) = [int(x) for x in stdin.readline().strip().split()]
	L1 = [int(x) for x in stdin.readline().strip().split()]
	L2 = [int(x) for x in stdin.readline().strip().split()]
	resu = []
	L1 = sorted(L1)
	for i in L2:
		resu.append(str(bina(i, 0, lo1 - 1)))
	print(' '.join(resu))
main()


import sys
import bisect

def get_line():
	return list(map(int, sys.stdin.readline().strip().split()))

def in1():
	return int(input())
(n1, m) = get_line()
a = get_line()
b = get_line()
a.sort()
c = []
for i in b:
	t1 = bisect.bisect(a, i)
	c.append(t1)
print(*c)


import bisect
(n, m) = map(int, input().split())
A = sorted(map(int, input().split()))
B = list(map(int, input().split()))
ans = []
for b in B:
	idx = bisect.bisect_right(A, b)
	ans.append(idx)
print(*ans)


from math import ceil, modf
from bisect import bisect
(n, m) = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]
a.sort()
for i in input().split():
	print(bisect(a, int(i)), end=' ')


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
import time
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string
start_time = time.time()

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def get_ints():
	return map(int, sys.stdin.readline().split())

def bs(e, arr):
	l = 0
	r = n - 1
	ans = -1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] <= e:
			ans = mid
			l = mid + 1
		else:
			r = mid - 1
	if ans == -1:
		return 0
	return ans + 1
(n, m) = map(int, input().split())
a = list(get_ints())
b = list(get_ints())
a = sorted(a)
ans = []
for i in range(m):
	e = b[i]
	k = bs(e, a)
	ans.append(k)
print(*ans)


from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = 100000009

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')
(m, n) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
for x in b:
	c.append(x)
a.sort()
b.sort()
i = 0
j = 0
M = dict()
while i < n:
	while j < m and a[j] <= b[i]:
		j += 1
	M[b[i]] = j
	i += 1
for x in c:
	print(M[x], end=' ')


import bisect
(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(j) for j in input().split()]
a.sort()
for k in range(m):
	print(bisect.bisect(a, b[k]))


from __future__ import print_function
import sys
import bisect
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
out = []
for x in b:
	i = bisect.bisect(a, x)
	out.append(str(i))
print(' '.join(out))


import bisect
(x, y) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
b = list(map(int, input().split()))
for i in b:
	print(bisect.bisect(a, i), end=' ')


from bisect import bisect_right
(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a.sort()
for i in b:
	print(bisect_right(a, i), end=' ')


from bisect import bisect_right
(n, m) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a.sort()
(l, r) = (0, len(a) - 1)
for x in b:
	print(bisect_right(a, x), end=' ')


import sys
from bisect import bisect
(n, m) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
b = list(map(int, sys.stdin.readline().split()))
a.sort()
ans = []
for i in range(m):
	ans.append(bisect(a, b[i]))
print(*ans)


import sys
input = sys.stdin.readline
read = lambda : map(int, input().split())
read_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(div, n):
	if div == 0:
		return True
	return n % div == 0
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
import bisect as bis
import random
import sys

def solve():
	(n, m) = read()
	a = list(read())
	b = list(read())
	a.sort()
	ans = []
	for x in b:
		ans.append(bis.bisect_right(a, x))
	print(*ans)
for _ in range(1):
	solve()


def search(a, k, e):
	b = 0
	r = 0
	while b <= e:
		x = b + (e - b) // 2
		if a[x] <= k:
			r = x + 1
			b = x + 1
		else:
			e = x - 1
	return r
(n, m) = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
for i in b:
	print(search(a, i, n - 1), end=' ')


from sys import stdin

def binary_search(data, val):
	highIndex = len(data) - 1
	lowIndex = 0
	while highIndex > lowIndex:
		index = (highIndex + lowIndex) // 2
		sub = data[index]
		if data[lowIndex] == val:
			return [lowIndex, lowIndex]
		elif sub == val:
			return [index, index]
		elif data[highIndex] == val:
			return [highIndex, highIndex]
		elif sub > val:
			if highIndex == index:
				return sorted([highIndex, lowIndex])
			highIndex = index
		else:
			if lowIndex == index:
				return sorted([highIndex, lowIndex])
			lowIndex = index
	return sorted([highIndex, lowIndex])
(n, m) = map(int, stdin.readline().rstrip().split(' '))
l = list(map(int, stdin.readline().rstrip().split(' ')))
l1 = list(map(int, stdin.readline().rstrip().split(' ')))
l.sort()
l_dict = {}
for i in range(n):
	z = l_dict.get(l[i], 0)
	if z:
		l_dict[l[i]] += 1
	else:
		l_dict[l[i]] = 1
r = []
t = 0
for (i, j) in l_dict.items():
	t += j
	r.append(t)
test = list(l_dict.keys())
for i in l1:
	if i < test[0]:
		print(0, end=' ')
	elif i > test[-1]:
		print(r[-1], end=' ')
	else:
		a = binary_search(test, i)
		print(r[a[0]], end=' ')


import bisect
(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
a.sort()
for i in range(m):
	print(bisect.bisect(a, b[i]), end=' ')


(n, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
a.sort()

def binarysearch(s, x):
	low = 0
	high = len(s) - 1
	ans = high + 1
	while high >= low:
		mid = (low + high) // 2
		if s[mid] <= x:
			low = mid + 1
		else:
			ans = mid
			high = mid - 1
	return ans
for i in range(len(b)):
	print(binarysearch(a, b[i]), end=' ')


(n, mm) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for i in range(mm):
	b[i] = [b[i], i]
b.sort()
ans = ['0' for i in range(mm)]
last = -1
for i in b:
	l = last
	r = n
	while r - l > 1:
		m = (r + l) // 2
		if a[m] <= i[0]:
			l = m
		else:
			r = m
	last = l
	ans[i[1]] = str(l + 1)
print(' '.join(ans))


import bisect as bi
(n, m) = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
for i in b:
	print(bi.bisect_right(a, i), end=' ')


input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for val in b:
	(l, r) = (0, len(a) - 1)
	while l <= r:
		mid = (l + r) // 2
		if a[mid] > val:
			r = mid - 1
		else:
			l = mid + 1
	print(l, end=' ')


import bisect
(n, m) = map(int, input().split())
lst = sorted(list(map(int, input().split())))
l = list(map(int, input().split()))
for d in l:
	print(bisect.bisect_right(lst, d), end=' ')


(n, m) = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
c = []
for (index, val) in enumerate(b):
	c.append((val, index))
c.sort(key=lambda x: x[0])
b = [0] * len(c)
counter = 0
left = 0
while left < len(c):
	if counter < len(a) and a[counter] <= c[left][0]:
		counter += 1
	else:
		index = c[left][1]
		b[index] = counter
		left += 1
print(*b)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
for i in range(m):
	c.append((b[i], i))
a.sort()
c.sort(key=lambda x: x[0])
ans = [0] * m
j = 0
for i in range(m):
	while j < n and a[j] <= c[i][0]:
		j += 1
	ans[c[i][1]] = j
for i in range(m):
	print(ans[i], end=' ')


from sys import stdin, stdout

def b_s(arr, l, r, target):
	while l + 1 < r:
		m = int((l + r) / 2)
		if arr[m] > target:
			r = m
		else:
			l = m
	return r

def main():
	outputs = []
	(n, m) = map(int, input().split())
	A = sorted([int(num) for num in input().split()])
	B = [int(num) for num in input().split()]
	for element in B:
		outputs.append(b_s(A, -1, n, element))
	for output in outputs:
		print(output)
main()


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def main():
	(n, m) = LI()
	a = LI()
	b = LI()
	c = collections.Counter(a)
	for k in b:
		c[k] += 0
	d = {}
	t = 0
	for (k, v) in sorted(c.items()):
		t += v
		d[k] = t
	return ' '.join(map(lambda x: str(d[x]), b))
print(main())


(n, m) = map(int, input().split())

def binsearch(nums, target):
	left = 0
	right = len(nums) - 1
	while left <= right:
		mid = (left + right) // 2
		if nums[mid] == target:
			return mid
		elif nums[mid] > target:
			right = mid - 1
		elif nums[mid] < target:
			left = mid + 1
	return left
arr1 = [int(z) for z in input().split()]
arr2 = [int(z) for z in input().split()]
arr1.sort()
res = []
for i in arr2:
	res.append(str(binsearch(arr1, i + 0.1)))
print(' '.join(res))


__author__ = 'sandeepmellacheruvu'
from bisect import bisect_right
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
c = []
for (i, ele) in enumerate(b):
	p = bisect_right(a, ele)
	c.append(p)
for (i, ele) in enumerate(c):
	print(ele, end=' ')
print()


from operator import itemgetter
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(m):
	b[i] = [i, b[i]]
output = []
a.sort()
b.sort(key=itemgetter(1))
i = 0
j = 0
while j < m:
	while i < n and a[i] <= b[j][1]:
		i += 1
	b[j].append(i)
	j += 1
b.sort()
for k in range(m):
	print(b[k][2], end=' ')


import sys
from bisect import bisect_right as br
input = sys.stdin.readline
(N, M) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
res = []
for x in b:
	r = br(a, x)
	res.append(r)
print(*res)


x = input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = b.copy()
b.sort()
a.sort()
ans = 0
j = 0
i = 0
ot = {}
while j in range(len(b)) and i in range(len(a)):
	if a[i] <= b[j]:
		ans += 1
		i += 1
	else:
		ot.update({b[j]: ans})
		j += 1
for i in range(len(c)):
	print(ot.get(c[i], len(a)), end=' ')


n = input()
a = input().split()
b = input().split()
for i in range(len(a)):
	a[i] = int(a[i])
for i in range(len(b)):
	b[i] = (int(b[i]), i)
a.sort()
b.sort()
amount = []
for i in range(len(b)):
	amount.append(0)
k = 0
for i in range(len(b)):
	while k < len(a) and b[i][0] >= a[k]:
		k += 1
	amount[b[i][1]] = k
for i in amount:
	print(i, end=' ')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
res = []
for i in b:
	if i < a[0]:
		res.append(0)
	else:
		left = 0
		right = n - 1
		ans = 0
		while left <= right:
			mid = (left + right) // 2
			if a[mid] <= i:
				ans = mid
				left = mid + 1
			else:
				right = mid - 1
		res.append(ans + 1)
print(*res)


_ = input()
a = list(map(int, input().split()))
b = list(enumerate(map(int, input().split())))
a.sort()
b.sort(key=lambda x: x[1])
r = [0] * len(b)
cnt = 0
(i, j) = (0, 0)
while j < len(b):
	if i >= len(a) or a[i] > b[j][1]:
		r[b[j][0]] = cnt
		j += 1
	else:
		cnt += 1
		i += 1
print(' '.join(map(str, r)))


import sys
import bisect

def FILE_IO():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
dic = dict()
for elm in b:
	c.append(elm)
a.sort()
b.sort()
i = j = 0
while i < m:
	while j < n and a[j] <= b[i]:
		j += 1
	dic[b[i]] = j
	i += 1
for elm in c:
	print(dic[elm], end=' ')


(n, m) = list(map(lambda t: int(t), input().split()))
a = list(map(lambda t: int(t), input().split()))
b = [[int(x), i, 0] for (i, x) in enumerate(input().split())]
a.sort()
b.sort()
i = 0
j = 0
while i < n and j < m:
	if j < m and i < n and (b[j][0] >= a[i]):
		i += 1
	else:
		j += 1
	if j < m:
		b[j][2] = i
while j < m:
	b[j][2] = i
	j += 1
b.sort(key=lambda x: x[1])
print(' '.join(list(map(lambda t: str(t[2]), b))))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
import bisect as bl
for i in b:
	ind = bl.bisect_right(a, i)
	print(ind, end=' ')


import bisect
(n, m) = [int(x) for x in input().split(' ')]
a = [int(x) for x in input().split(' ')]
b = [int(x) for x in input().split(' ')]
a = sorted(a)
max = a[n - 1]
min = a[0]
res = []
for i in range(0, m):
	if b[i] >= max:
		b[i] = n
	else:
		b[i] = bisect.bisect_right(a, b[i])
print(' '.join(map(lambda x: str(x), b)))


from collections import defaultdict
from bisect import bisect_left
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
res = list()
map_a = defaultdict(lambda : 0)
for i in a:
	map_a[i] += 1
keys = sorted(map_a.keys())
map_sum_a = dict()
first_key = keys[0]
cur_value = map_a[first_key]
map_sum_a[first_key] = cur_value
for key in keys[1:]:
	cur_value += map_a[key]
	map_sum_a[key] = cur_value
for item in b:
	if item in map_sum_a:
		res.append(map_sum_a[item])
	else:
		pos = bisect_left(keys, item)
		if pos == 0:
			res.append(0)
		else:
			res.append(map_sum_a[keys[pos - 1]])
print(' '.join(map(str, res)))


n = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for i in range(0, n[1]):
	l = 0
	h = n[0] - 1
	while l <= h:
		mid = int((l + h) / 2)
		if a[mid] <= b[i]:
			l = mid + 1
		else:
			h = mid - 1
	print(h + 1, end=' ')


from bisect import bisect_right
(n, m) = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
z = []
for i in list(map(int, input().split())):
	z.append(str(bisect_right(arr, i)))
print(' '.join(z))


import sys
import bisect
input = sys.stdin.readline
(n, m) = map(int, input().split())
num = list(map(int, input().split()))
ms = list(map(int, input().split()))
num.sort()
ans = []
for i in ms:
	ans.append(str(bisect.bisect_right(num, i)))
print(' '.join(ans))


input()
listA = list(map(int, input().split()))
listB = list(map(int, input().split()))
numbers = {}
listBaux = listB
listB = sorted(listB)
listA.sort()
i = 0
j = 0
count = 0
for u in listB:
	numbers[str(u)] = 0
while i < len(listA) and j < len(listB):
	if listA[i] <= listB[j]:
		count += 1
	else:
		numbers[str(listB[j])] = count
	if listA[i] <= listB[j]:
		if i == len(listA) - 1:
			for elem in range(j, len(listB)):
				numbers[str(listB[elem])] = count
		i += 1
	else:
		j += 1
for p in listBaux:
	print(numbers[str(p)], end=' ')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
b = list(map(int, input().split()))

def f(k):
	lo = 0
	hi = n
	while lo < hi:
		mid = (lo + hi) // 2
		if k < a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo
x = []
for i in b:
	x.append(f(i))
print(*x)


import bisect
input()
anums = sorted(map(int, input().split()))
bnums = map(int, input().split())
indices = [bisect.bisect(anums, b) for b in bnums]
print(' '.join(map(str, indices)))


def bynary(start, end, e):
	if start == end:
		if lista[start] <= e:
			return start
		return -1
	meio = start + (end - start) // 2
	if e < lista[meio]:
		return bynary(start, meio, e)
	aux = bynary(meio + 1, end, e)
	if aux == -1:
		return meio
	return aux
(n, m) = map(int, input().split())
lista = list(map(int, input().split()))
lista.sort()
resu = []
for e in map(int, input().split()):
	aux = bynary(0, n - 1, e) + 1
	resu.append(str(aux))
print(' '.join(resu))


import bisect
input()
(a, b) = [[int(j) for j in input().split()] for _ in range(2)]
a = sorted(a)
print(' '.join([str(bisect.bisect(a, j)) for j in b]))


(n, m) = map(int, input().strip().split(' '))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
a = sorted(a)

def binarySearch(arr, l, r, x):
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			l = mid + 1
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return r + 1
for i in range(len(b)):
	x = b[i]
	k = 1
	s = binarySearch(a, 0, len(a) - 1, x)
	print(s, end=' ')


from bisect import *
(n, m) = map(int, input().split())
l = list(map(int, input().split()))
d = list(map(int, input().split()))
l.sort()
k = []
for i in range(m):
	k.append(bisect(l, d[i]))
print(*k)


import bisect
(n, m) = map(int, input().split())
a = sorted(map(int, input().split()))
b = map(int, input().split())
for b_i in b:
	print(bisect.bisect_right(a, b_i))


def read_list():
	return [int(i) for i in input().split()]

def new_list(n):
	return [0 for i in range(n)]

def new_matrix(n, m=0):
	return [[0 for i in range(m)] for i in range(n)]
(n, m) = read_list()
_a = read_list()
_b = read_list()
(a, b) = ([], [])
for i in range(n):
	a.append([_a[i], i])
for i in range(m):
	b.append([_b[i], i])
a.sort(key=lambda u: u[0])
b.sort(key=lambda u: u[0])
answ = new_list(m)
i = j = c = 0
while i < n and j < m:
	if a[i][0] <= b[j][0]:
		c += 1
		i += 1
	else:
		answ[b[j][1]] = c
		j += 1
while j < m:
	answ[b[j][1]] = c
	j += 1
print(' '.join([str(i) for i in answ]))


import random, math
from copy import deepcopy as dc

def randomNumber(s, e):
	return random.randint(s, e)

def randomArray(s, e, s_size, e_size):
	size = random.randint(s_size, e_size)
	arr = [randomNumber(s, e) for i in range(size)]
	return arr

def testcase():
	pass

def brute():
	pass

def effe():
	pass

def solution(a, b):
	c = []
	for i in range(len(a)):
		c.append([a[i], -1])
	for j in range(len(b)):
		c.append([b[j], j])
	c = sorted(c, key=lambda x: x[0])
	count = 0
	ans = [0] * len(b)
	for i in c:
		if i[1] < 0:
			count += 1
		else:
			ans[i[1]] = dc(count)
	return ans

def input_test():
	(n, m) = map(int, input().strip().split(' '))
	a = list(map(int, input().strip().split(' ')))
	b = list(map(int, input().strip().split(' ')))
	out = solution(a, b)
	print(' '.join(map(str, out)))

def test():
	pass
input_test()


(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
a.sort()
for i in b:
	lo = 0
	hi = n - 1
	while lo < hi:
		mid = lo + (hi - lo + 1 >> 1)
		if a[mid] > i:
			hi = mid - 1
		else:
			lo = mid
	if a[lo] > i:
		lo -= 1
	print(max(0, lo + 1), end=' ')
print()


from collections import *
from math import *
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
l = list(map(int, input().split()))
b = []
for i in range(m):
	b.append([l[i], i])
a.sort()
b.sort()
i = 0
for j in range(m):
	while i < n and a[i] <= b[j][0]:
		i += 1
	l[b[j][1]] = i
for i in l:
	print(i, end=' ')
print()


import bisect

def __starting_point():
	(n, m) = [int(x) for x in input().strip().split()]
	a = sorted([int(x) for x in input().strip().split()])
	b = [int(x) for x in input().strip().split()]
	res = []
	for bi in b:
		pos = bisect.bisect_left(a, bi)
		if pos < n and a[pos] == bi:
			res.append(bisect.bisect_right(a, bi))
		else:
			res.append(pos)
	print(' '.join([str(x) for x in res]))
__starting_point()


x = input().split()
a = [int(g) for g in input().split()]
b = [int(g) for g in input().split()]
a = sorted(a)
import bisect
for i in b:
	c = bisect.bisect_right(a, i)
	print(c, end=' ')


from sys import stdin, stdout, setrecursionlimit
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm, accumulate
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
setrecursionlimit(10 ** 9)
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return input()

def num():
	return int(input())

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]

def pmat(A):
	for ele in A:
		print(*ele, end='\n')

def pmat2(A):
	for ele in A:
		for j in ele:
			print(j, end='')
		print()

def iseven(n):
	return n % 2 == 0

def seive(r):
	prime = [1 for i in range(r + 1)]
	prime[0] = 0
	prime[1] = 0
	for i in range(r + 1):
		if prime[i]:
			for j in range(2 * i, r + 1, i):
				prime[j] = 0
	return prime
(n, m) = sp()
a = sorted(L())
b = L()
for i in b:
	print(br(a, i), end=' ')
endtime = time.time()


def main():
	blah = input()
	a = input().split()
	a = [int(x) for x in a]
	b = input().split()
	b = [int(x) for x in b]
	result = solver(a, b)
	for x in result:
		print(x, end=' ')

def solver(a, b):
	A = sorted(a)
	B = [(b[i], i) for i in range(len(b))]
	B = sorted(B, key=lambda pair: pair[0])
	result = []
	pA = 0
	pB = 0
	while pB < len(B):
		curr = B[pB][0]
		while pA < len(A) and A[pA] <= curr:
			pA += 1
		pair = (B[pB][1], pA)
		result.append(pair)
		pB += 1
	result = sorted(result, key=lambda pair: pair[0])
	result = [pair[1] for pair in result]
	return result
main()


import bisect
from collections import Counter, defaultdict
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
(n, m) = M()
a = LI()
b = LI()
a.sort()
for i in range(m):
	print(bisect.bisect_right(a, b[i]), end=' ')


from bisect import bisect
(n, m) = map(int, input().strip().split())
a = list(map(int, input().strip().split()))
b = list(map(int, input().strip().split()))
a.sort()
ans = []
for ele in b:
	ans.append(bisect(a, ele))
print(*ans)


from bisect import bisect_right as bi
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
ans = []
for i in b:
	ans.append(bi(a, i))
print(*ans)


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b_index = []
for i in range(len(b)):
	b_index.append([b[i], i])
b_index.sort()
ans = [0] * len(b)
ptr = 0
for i in range(len(b)):
	while ptr < n and a[ptr] <= b_index[i][0]:
		ptr += 1
	ans[b_index[i][1]] = ptr
for a in ans:
	print(a, end=' ')


def binSearch(lst, n):
	(L, R) = (0, len(lst) - 1)
	ans = -1
	while L <= R:
		mid = (L + R) // 2
		if lst[mid] > n:
			R = mid - 1
		else:
			ans = mid
			L = mid + 1
	return ans
(n, m) = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
for i in range(m):
	print(binSearch(a, b[i]) + 1, end=' ')


from bisect import bisect_right
(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
a.sort()
for i in range(m):
	ans = bisect_right(a, b[i])
	if ans:
		print(ans, end=' ')
	else:
		print(0, end=' ')


def bin_search(k):
	l = -1
	r = n - 1
	while r - l > 1:
		h = (l + r) // 2
		if lst1[h] > k:
			r = h
		else:
			l = h
	if lst1[r] <= k:
		return r + 1
	else:
		return r
(n, m) = [int(x) for x in input().split()]
lst1 = [int(x) for x in input().split()]
lst2 = [int(x) for x in input().split()]
lst1.sort()
for i in range(m):
	print(bin_search(lst2[i]), end=' ')


(n, m) = map(int, input().split())
a = sorted([int(i) for i in input().split()] + [10 ** 9 + 7])
b = [int(i) for i in input().split()]
d = b.copy()
b.sort()
(i, j) = (0, 0)
e = {}
while i <= n and j < m:
	if b[j] >= a[i]:
		i += 1
	else:
		e[b[j]] = i
		j += 1
for i in d:
	print(e[i], end=' ')


import bisect
(n, m) = list(map(int, input().split()))
s1 = list(map(int, input().split()))
s2 = list(map(int, input().split()))
s1.sort()
r = []
for i in s2:
	r.append(bisect.bisect(s1, i))
print(*r, end=' ')


(m, n) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
arrA = []
for i in range(m):
	arrA.append((a[i], i))
for i in range(n):
	l = 0
	r = m - 1
	res = -1
	while l <= r:
		mid = (l + r) // 2
		if arrA[mid][0] <= b[i]:
			res = mid
			l = mid + 1
		else:
			r = mid - 1
	if res == -1:
		print(0)
	else:
		print(arrA[res][1] + 1, end=' ')


def sort_queries(a, b):
	a = sorted(a)
	c = b[:]
	c = sorted(c)
	i = 0
	counts = []
	dict = {}
	for j in range(len(c)):
		while i < len(a) and a[i] <= c[j]:
			i += 1
		dict[c[j]] = i
	for k in b:
		print(dict[k], end=' ')
(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
sort_queries(a, b)


from bisect import bisect_right
(n, m) = [int(p) for p in input().split()]
arr1 = sorted([int(p) for p in input().split()])
arr2 = [int(p) for p in input().split()]
index = []
for i in range(len(arr2)):
	index.append(bisect_right(arr1, arr2[i]))
print(*index)


import bisect

def main():
	(m, n) = input().split()
	m = int(m)
	n = int(n)
	a = input().split()
	b = input().split()
	for i in range(0, len(a)):
		a[i] = int(a[i])
	for i in range(0, len(b)):
		b[i] = int(b[i])
	a.sort()
	ans = []
	for value in b:
		where = bisect.bisect_right(a, value, lo=0, hi=len(a))
		ans.append(where)
	for x in range(0, len(ans) - 1):
		print(ans[x], end=' ')
	print(ans[len(ans) - 1])
main()


import sys
import math
arrLenths = sys.stdin.readline()
a = [int(i) for i in sys.stdin.readline().split(' ')]
b_p = [int(i) for i in sys.stdin.readline().split(' ')]
b = [(b_p[i], i) for i in range(len(b_p))]
output = [0] * len(b)
a.sort()
b.sort()
count = 0
for (bj, i) in b:
	while count < len(a) and a[count] <= bj:
		count += 1
	output[i] = count
for bj in output:
	sys.stdout.write(str(bj) + ' ')


import bisect
(m, n) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
ans = [str(bisect.bisect_right(a, b[i])) for i in range(len(b))]
print(' '.join(ans))


from bisect import bisect_right
(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
for i in list(map(int, input().split())):
	print(bisect_right(l, i, lo=0, hi=len(l)), end=' ')


import bisect
entrada = input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
elem = ''
a.sort()
for i in range(len(b)):
	print(bisect.bisect_right(a, b[i]), end=' ')
print(elem)


import bisect
(a, b) = input().split()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
kp = []
for k in b:
	kp.append(str(bisect.bisect_right(a, k)))
print(' '.join(kp))


from bisect import *
(n, m) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l1.sort()
for i in l2:
	print(bisect_right(l1, i), end=' ')


from bisect import bisect
tmp = input().split()
n = int(tmp[0])
m = int(tmp[1])
ls1 = [int(x) for x in input().split()]
ls2 = [int(x) for x in input().split()]
ls1.sort()
for i in range(0, m):
	ls2[i] = bisect(ls1, ls2[i])
for x in ls2:
	print(x, end=' ')


import bisect

def solve(xs, ys, n, m):
	xs.sort()
	return [bisect.bisect_right(xs, y) for y in ys]

def main():
	(n, m) = list(map(int, input().split()))
	xs = [int(c) for c in input().split()]
	ys = [int(c) for c in input().split()]
	assert len(xs) == n
	assert len(ys) == m
	result = solve(xs, ys, n, m)
	print(*result)

def __starting_point():
	main()
__starting_point()


def main():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = [(i, x) for (i, x) in enumerate(map(int, input().split()))]
	a.sort()
	b.sort(key=lambda p: p[1])
	j = -1
	output = [None] * m
	for (i, x) in b:
		while j + 1 < n and a[j + 1] <= x:
			j += 1
		output[i] = j + 1
	for i in range(m):
		if i > 0:
			print(' ', end='')
		print(output[i], end='')
	print('')
main()


(n, m) = map(int, input().split())
na = input().split()
mb = input().split()
a = []
for i in range(n):
	a.append(int(na[i]))
l = []
b = []
for i in range(m):
	b.append([int(mb[i]), i])
	l.append(0)
a.sort()
a.append(1000000000000000)
b.sort()
p1 = 0
p2 = 0
while p1 < m:
	if a[p2] > b[p1][0]:
		rr = b[p1][1]
		l[rr] = p2
		p1 = p1 + 1
	else:
		p2 = p2 + 1
for i in range(len(l)):
	print(l[i], end=' ')


def main():
	(n, m) = [int(i) for i in input().split()]
	aa = [int(i) for i in input().split()]
	bb = [int(i) for i in input().split()]
	aa.sort()
	ans = []
	for b in bb:
		cnt = 0
		for a in aa:
			if a <= b:
				cnt += 1
		ans.append(str(cnt))
	print(' '.join(ans))

def upper_bound(lst, target):
	l = 0
	r = len(lst) - 1
	res = -1
	while l <= r:
		mid = (l + r) // 2
		if lst[mid] <= target:
			res = mid
			l = mid + 1
		else:
			r = mid - 1
	return res + 1

def main2():
	(n, m) = [int(i) for i in input().split()]
	aa = [int(i) for i in input().split()]
	bb = [int(i) for i in input().split()]
	aa.sort()
	ans = ''
	for b in bb:
		k = upper_bound(aa, b)
		ans += str(k) + ' '
	print(ans)
main2()


(n, m) = map(int, input().split())
p1 = 0
p2 = 0
br = 0
ind = 0
li = []
l1 = input().split()
l2 = input().split()
ld = [0 for i in range(m)]
for i in range(n):
	l1[i] = int(l1[i])
for i in range(m):
	l2[i] = int(l2[i])
	li.append((l2[i], i))
l1.sort()
li.sort()
for i in range(m):
	while p2 < n and l1[p2] <= li[i][0]:
		p2 += 1
		br += 1
	ind = li[i][1]
	ld[ind] = br
for i in range(len(ld)):
	print(ld[i], end=' ')


def floor(a, k):
	l = 0
	h = len(a) - 1
	ans = -1
	while l <= h:
		m = (l + h) // 2
		if a[m] <= k:
			ans = m
			l = m + 1
		else:
			h = m - 1
	return ans + 1
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for i in b:
	print(floor(a, i), end=' ')


(m, n) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
bs = list(sorted(b))
(d, i) = ({}, 0)
for j in range(n):
	while i < m and a[i] <= bs[j]:
		i += 1
	d[bs[j]] = i
ans = []
for j in range(n):
	ans.append(d[b[j]])
print(*ans)


(n1, n2) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
order = [t for t in range(n2)]
a.sort()
order.sort(key=lambda x: b[x])
b.sort()
j = 0
ans = [[t, 0] for t in range(n2 + 1)]
for i in range(n2):
	if j == n1:
		for k in range(i, n2):
			ans[k + 1][1] = ans[k][1]
		break
	ans[i + 1][1] += ans[i][1]
	while j != n1 and a[j] <= b[i]:
		ans[i + 1][1] += 1
		j += 1
ans = ans[1:]
ans.sort(key=lambda x: order[x[0] - 1])
for i in ans:
	print(i[1], end=' ')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
z = int(1000000000.0) + 7
a = [-1 * z] + a + [z]
b = list(map(int, input().split()))
ans = []
for i in b:
	(l, r) = (1, n + 1)
	while l < r:
		mid = (l + r) // 2
		if a[mid] <= i:
			l = mid + 1
		else:
			r = mid
	ans.append(l - 1)
print(*ans)


(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a.sort()
b_ = [(b[j], j) for j in range(m)]
b_.sort()
ans = [0 for j in range(m)]
i = 0
for j in range(m):
	while i < n and a[i] <= b_[j][0]:
		i += 1
	ans[b_[j][1]] = i
print(*ans)


import bisect
(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b = list(enumerate(b))
b.sort(key=lambda e: e[1])
result = dict()
(index_a, index_b) = (0, 0)
for index_b in range(m):
	while index_a < n and a[index_a] <= b[index_b][1]:
		index_a += 1
	result[b[index_b][1]] = index_a
b.sort(key=lambda e: e[0])
print(' '.join(list(map(lambda e: str(result[e[1]]), b))))


(m, n) = map(int, input().split())
nums1 = sorted(list(map(int, input().split())))
nums2 = list(map(int, input().split()))
for i in range(n):
	nums2[i] = (nums2[i], i)
nums2.sort()
a = 0
ans = [1] * n
for i in range(n):
	while a < m and nums1[a] <= nums2[i][0]:
		a += 1
	ans[nums2[i][1]] = a
print(*ans)


(n, m) = list(map(int, input().split()))
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
d = {}
for i in arr2:
	d[i] = 0
temp1 = arr1[:]
temp2 = arr2[:]
temp1.sort()
temp2.sort()
(ind1, ind2) = (0, 0)
while True:
	if temp2[ind2] >= temp1[ind1]:
		ind1 += 1
	else:
		d[temp2[ind2]] = ind1
		ind2 += 1
	if ind1 >= n or ind2 >= m:
		break
for i in range(ind2, m):
	d[temp2[i]] = ind1
for i in arr2:
	print(d[i], end=' ')


import bisect
(n, q) = map(int, input().split())
ar = list(map(int, input().split()))
qq = list(map(int, input().split()))
ar.sort()
for x in qq:
	print(bisect.bisect_right(ar, x), end=' ')
print()


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for e in b:
	ans = 0
	(l, r) = (0, len(a) - 1)
	while l <= r:
		m = l + (r - l) // 2
		if a[m] <= e:
			ans = m + 1
			l = m + 1
		else:
			r = m - 1
	print(ans, end=' ')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
uva = b.copy()
b.sort()
(ia, ib) = (0, 0)
qntd = 0
dic = {}
while ia <= n and ib < m:
	if ia == n:
		dic[b[ib]] = qntd
		ib += 1
	elif b[ib] >= a[ia]:
		qntd += 1
		ia += 1
	else:
		dic[b[ib]] = qntd
		ib += 1
for i in range(m - 1):
	print(dic[uva[i]], end=' ')
print(dic[uva[-1]])


from bisect import *
(n, q) = (int(x) for x in input().split())
a = []
for i in (int(x) for x in input().split()):
	a.append(i)
a.sort()
for i in (int(x) for x in input().split()):
	print(bisect_right(a, i))


(N, M) = map(int, input().split())
A = [int(x) for x in input().split()]
A.sort()
B = [int(x) for x in input().split()]
for i in B:
	low = 0
	high = N - 1
	while low <= high:
		mid = low + high >> 1
		if low == high:
			if A[low] <= i:
				print(low + 1, end=' ')
			else:
				print(low, end=' ')
			break
		elif A[mid] > i:
			high = mid
		else:
			low = mid + 1


def binsrch(a, m):
	l = 0
	r = len(a) - 1
	ans = len(a)
	while l <= r:
		mid = l + (r - l) // 2
		if a[mid] > m:
			ans = mid
			r = mid - 1
		else:
			l = mid + 1
	return ans
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for i in b:
	print(binsrch(a, i), end=' ')


import bisect as bt
from sys import stdin, stdout

def b_s(arr, l, r, target):
	while l + 1 < r:
		m = int((l + r) / 2)
		if arr[m] > target:
			r = m
		else:
			l = m
	return r

def main():
	outputs = []
	(n, m) = map(int, stdin.readline().strip().split())
	A = sorted([int(num) for num in stdin.readline().strip().split()])
	B = [int(num) for num in stdin.readline().strip().split()]
	for element in B:
		outputs.append(b_s(A, -1, n, element))
	for output in outputs:
		stdout.write(str(output) + '\n')
main()


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for t in b:
	if t < a[0]:
		print(0, end=' ')
	elif t >= a[-1]:
		print(n, end=' ')
	else:
		l = 0
		r = n - 1
		while l <= r:
			mid = (r + l) // 2
			if a[mid] <= t and a[mid + 1] > t:
				print(mid + 1, end=' ')
				break
			elif a[mid] <= t:
				l = mid + 1
			else:
				r = mid - 1


import bisect
(n, m) = map(int, input().split())
ara1 = [int(x) for x in input().split()]
ara2 = [int(x) for x in input().split()]
ara1.sort()
for i in range(m):
	print(bisect.bisect(ara1, ara2[i]))


(a, b) = input().split()
a = int(a)
b = int(b)
arr = input()
arr = list(map(int, arr.split()))
arr.sort()
brr = input()
b = {}
brr = list(map(int, brr.split()))
for x in brr:
	b[x] = 0
count = 0
for x in sorted(b.keys()):
	if count < len(arr):
		while x >= arr[count]:
			count = count + 1
			if count >= len(arr):
				break
	b[x] = count
for x in brr:
	print(b[x], end=' ')


import sys
input = sys.stdin.readline

def main():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	b = [(b[i], i) for i in range(m)]
	a.sort()
	b.sort()
	r = [0] * m

	def bs(v):
		l = 0
		r = n - 1
		while l <= r:
			m = r + l >> 1
			k = a[m]
			if k <= v:
				l = m + 1
			else:
				r = m - 1
		return l
	for i in range(m):
		(v, j) = b[i]
		k = bs(v)
		r[j] = str(k)
	print(' '.join(r))
main()


_ = input()
l = sorted(map(int, input().split()))
queries = list(map(int, input().split()))
s_queries = sorted(queries)
ans = {}
i = 0
j = 0
while j < len(s_queries):
	if s_queries[j] not in ans:
		if i < len(l) and l[i] <= s_queries[j]:
			if i != len(l) - 1 and l[i + 1] <= s_queries[j]:
				i += 1
			else:
				ans[s_queries[j]] = i + 1
				j += 1
		else:
			ans[s_queries[j]] = 0
			j += 1
	else:
		j += 1
print(ans[queries[0]], end='')
for i in range(1, len(queries)):
	print(' ', ans[queries[i]], sep='', end='')
print('')


[n, m] = list(map(int, input().split()))
a = list(sorted(map(int, input().split())))
a.append(10 ** 12)
b = list(sorted(zip(map(int, input().split()), range(m))))
c = [None] * m
l = 0
for x in b:
	while a[l] <= x[0]:
		l += 1
	c[x[1]] = str(l)
print(' '.join(c))


from bisect import bisect
try:
	while True:
		(n, m) = map(int, input().split())
		a = list(map(int, input().split()))
		a.sort()
		for x in map(int, input().split()):
			print(bisect(a, x), end=' ')
		print()
except EOFError:
	pass


def main():
	input()
	aa = list(map(int, input().split()))
	aa.sort()
	bb = list(map(int, input().split()))
	bi = sorted(range(len(bb)), key=bb.__getitem__)
	aa.append(bb[bi[-1]] + 1)
	it = iter(enumerate(aa))
	(j, a) = next(it)
	for i in bi:
		b = bb[i]
		while b >= a:
			(j, a) = next(it)
		bb[i] = j
	print(' '.join(map(str, bb)))
main()


(n, m) = map(int, input().rstrip().rsplit())
a = list(map(int, input().rstrip().rsplit()))
b = list(map(int, input().rstrip().rsplit()))
dic = dict(((i, b[i]) for i in range(m)))
sort_dic = sorted(dic.items(), key=lambda kv: (kv[1], kv[0]))
sort_a = sorted(a)
sort_b = sorted(b)
g_list = []
(i, j) = (0, 0)
while i < n and j < m:
	if sort_a[i] <= sort_b[j]:
		i += 1
	else:
		g_list.append(i)
		j += 1
while j < m:
	g_list.append(i)
	j += 1
ans_list = [-1] * m
count = 0
for k in range(len(sort_dic)):
	ans_list[sort_dic[k][0]] = g_list[count]
	count += 1
print(*ans_list)


(n, m) = map(int, input().split())
from bisect import bisect_right
a = list(map(int, input().split()))
b = list(map(int, input().split()))

def solve(a, b):
	l = []
	for j in range(m):
		cout = bisect_right(a, b[j])
		l.append(cout)
	print(*l)
a.sort()
solve(a, b)


import bisect
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for i in range(m):
	try:
		l = bisect.bisect_right(a, b[i], lo=0, hi=n)
		print(l)
	except:
		print(n)


import sys
import math
import collections
import bisect

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
for t in range(1):
	(n, m) = get_ints()
	a = get_list()
	b = get_list()
	a.sort()
	ans = []
	for i in b:
		pos = bisect.bisect_right(a, i)
		ans.append(pos)
	print(*ans)


import bisect
input()
given = sorted([int(x) for x in input().split()])
for i in [int(x) for x in input().split()]:
	print(bisect.bisect(given, i), end=' ')


(m, n) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
for x in b:
	c.append(x)
a.sort()
b.sort()
i = 0
j = 0
M = dict()
while i < n:
	while j < m and a[j] <= b[i]:
		j += 1
	M[b[i]] = j
	i += 1
for x in c:
	print(M[x], end=' ')


from bisect import bisect
(n, m) = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
out = []
for el in b:
	out.append(str(bisect(a, el)))
print(' '.join(out))


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	ans = []
	for i in range(m):
		cnt = bisect.bisect_right(a, b[i])
		ans.append(cnt)
	print(' '.join([str(x) for x in ans]))
main()


import sys
f = sys.stdin
f.readline()
a = [int(x) for x in f.readline().strip().split()]
b = [int(x) for x in f.readline().strip().split()]
a.sort()
from bisect import *
for x in b:
	print(bisect(a, x), end=' ')


from bisect import bisect
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
ans = []
for i in range(m):
	ans.append(bisect(a, b[i]))
print(*ans)


import os
import sys
from io import BytesIO, IOBase
from bisect import bisect

def solution(arr, brr):
	arr.sort()
	res = [bisect(arr, x) for x in brr]
	write(*res)

def main():
	(n, m) = r_array()
	arr = r_array()
	brr = r_array()
	solution(arr, brr)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


from sys import stdin, stdout
from collections import *
from math import gcd, floor, ceil
from bisect import bisect_right
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():
	(n, q) = mp()
	ans = []
	l = li()
	k = li()
	l.sort()
	for i in k:
		ans.append(bisect_right(l, i))
	print(*ans)
for _ in range(1):
	solve()


import sys
from bisect import bisect_right
(n, m) = map(int, input().split())
a = sorted(map(int, input().split()))
b = list(map(int, input().split()))
print(*(bisect_right(a, x) for x in b))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b_ = list(map(int, input().split()))
dp = {x: 0 for x in b_}
a.sort()
b = sorted(b_)
i = 0
while i < n and a[i] <= b[0]:
	i += 1
dp[b[0]] = i
for x in b[1:]:
	while i < n and a[i] <= x:
		i += 1
	dp[x] = i
for i in b_:
	print(dp[i], end=' ')


def bs(a, n, x):
	l = 0
	r = n - 1
	ans = 0
	while l <= r:
		mid = l + int(int(r - l) / 2)
		if a[mid] <= x:
			ans = mid + 1
			l = mid + 1
		else:
			r = mid - 1
	return ans
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for x in b:
	print(bs(a, n, x))


import bisect
(n, m) = map(int, input().split())
S = [int(i) for i in input().split()]
S.sort()
p = [int(i) for i in input().split()]
for i in range(0, len(p)):
	pos = bisect.bisect_right(S, p[i])
	print(pos, end=' ')


(n, m) = [*map(int, input().split())]
l1 = [*map(int, input().split())]
l2 = [*map(int, input().split())]
l1.sort()
newl2 = sorted(set(l2))
cont = {}
index = 0
for e in newl2:
	while index < n and l1[index] <= e:
		index += 1
	cont[e] = index
result = []
for e in l2:
	result.append(str(cont[e]))
print(' '.join(result))


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = sorted(a)

def count(bi):
	lo = -1
	hi = n
	while hi - lo > 1:
		mid = int((lo + hi) / 2)
		if bi >= a[mid]:
			lo = mid
		else:
			hi = mid
	return hi
for bi in b:
	print(count(bi), end=' ')


n = input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(len(b)):
	b[i] = [b[i], i]
a.sort()
b.sort(key=lambda x: x[0])
y = 0
x = 0
result = [0] * len(b)
while y < len(b):
	while x < len(a) and a[x] <= b[y][0]:
		x += 1
	result[b[y][1]] = x
	y += 1
for i in result:
	print(i, end=' ')


def binary(aim, start, end):
	if start > end:
		return end if a[end] <= aim else end - 1
	mid = (start + end) // 2
	if a[mid] == aim:
		while mid < n and a[mid] == aim:
			mid += 1
		return mid - 1
	if a[mid] < aim:
		return binary(aim, mid + 1, end)
	else:
		return binary(aim, start, mid - 1)
inp = lambda : [*map(int, input().split())]
(n, m) = inp()
a = sorted(inp())
d = {}
for i in inp():
	if not i in d:
		d[i] = max(0, binary(i, 0, n - 1) + 1)
	print(d[i], end=' ')
print()


x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()
b = [int(i) for i in input().split()]

def f(k):
	lo = 0
	hi = x[0]
	while lo < hi:
		mid = (lo + hi) // 2
		if k < a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo
l1 = []
for i in b:
	l1.append(f(i))
print(*l1)


import math
(n, m) = map(int, input().split())
a = [i for i in map(int, input().split())]
b = [j for j in map(int, input().split())]
d = []
for i in range(m):
	d.append([b[i], i])
c = sorted(a)
d.sort()
ans = [0 for k in range(m)]
count = 0
(i, j) = (0, 0)
c.append(math.inf)
while j < m:
	if c[i] <= d[j][0]:
		count += 1
		i += 1
	else:
		ans[d[j][1]] = count
		j += 1
for s in range(m):
	print(ans[s])


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
k = len(b)
j = len(a)
arr = []
for i in range(k):
	start = 0
	end = j - 1
	while start < end:
		pivot = (start + end) // 2
		if a[pivot] > b[i]:
			if a[pivot - 1] <= b[i]:
				end = pivot - 1
				break
			else:
				end = pivot - 1
		elif a[pivot + 1] > b[i]:
			end = pivot
			break
		else:
			start = pivot + 1
	if end < 0:
		end = 0
	if a[end] <= b[i]:
		arr.append(end + 1)
	else:
		arr.append(end)
print(*arr)


import bisect
(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
a.sort()
b = [int(x) for x in input().split()]
l = []
for i in b:
	l.append(str(bisect.bisect(a, i)))
print(' '.join(l))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for c in b:
	l = -1
	r = len(a)
	while l + 1 < r:
		m = (l + r) // 2
		if a[m] > c:
			r = m
		else:
			l = m
	print(l + 1, end=' ')


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
a = sorted(map(int, input().split()))
for q in map(int, input().split()):
	if q >= a[-1]:
		print(n, end=' ')
	else:
		low = 0
		high = n
		while high - low:
			t = (low + high) // 2
			if q >= a[t]:
				low = t + 1
			else:
				high = t
		print(low, end=' ')


import math, sys
from collections import defaultdict, Counter, deque
INF = float('inf')
MOD = 1000000007

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactors(n):
	factors = []
	i = 2
	while i ** 2 <= n:
		while n % i == 0:
			factors.append(i)
			n //= i
		i += 1
	if n > 1:
		factors.append(n)
	return factors

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def main():
	(n, m) = vars()
	a = array()
	b = array()
	a.sort()
	ans = []
	for i in range(m):
		l = 0
		r = n - 1
		while l <= r:
			m = (l + r) // 2
			if a[m] > b[i]:
				r = m - 1
			else:
				l = m + 1
		ans.append(l)
	print(*ans)
t = 1
for _ in range(t):
	main()


(tam1, tam2) = input().split()
tam1 = int(tam1)
tam2 = int(tam2)
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l1.sort()
l2Ord = list(set(l2.copy()))
l2Ord.sort()
dic = {}
j = 0
acc = 0
for i in range(len(l2Ord)):
	while j <= tam1 - 1:
		if l1[j] <= l2Ord[i]:
			j += 1
		else:
			break
	dic[l2Ord[i]] = j
	i += 1
resp = []
for i in range(tam2):
	resp.append(str(dic[l2[i]]))
print(' '.join(resp))


import sys
import bisect
input = sys.stdin.readline
(m, n) = input().strip().split()
m = int(m)
n = int(n)
a = list(map(int, input().split()))
a.sort()
b = list(map(int, input().strip().split()))
out = []
for k in range(n):
	out.append(str(bisect.bisect_left(a, b[k] + 1)))
print(' '.join(out))


(na, nb) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
c = []

def bs(arr, x):
	l = 0
	ans = 0
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] <= x:
			ans = mid + 1
			l = mid + 1
		else:
			r = mid - 1
	return ans
for y in b:
	c.append(str(bs(a, y)))
print(' '.join(c))


import bisect
(n, m) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a.sort()
ans = []
for i in range(m):
	res = bisect.bisect_right(a, b[i])
	ans += [res]
print(*ans)


import bisect
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
output = ''
for x in b:
	output += str(bisect.bisect(a, x)) + ' '
print(output)


from bisect import bisect_right
input()
a = list(map(int, input().split()))
b = map(int, input().split())
a.sort()
res = []
for x in b:
	i = bisect_right(a, x)
	res.append(str(i))
print(' '.join(res))


import bisect
(n, m) = list(map(int, input().split()))
ara1 = list(map(int, input().split()))
ara2 = list(map(int, input().split()))
ara1.sort()
for i in ara2:
	print(bisect.bisect(ara1, i))


(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a.sort()

def bs_first_greater(arr, start, end, val):
	if start > end:
		return -1
	mid = (start + end) // 2
	if arr[mid] > val:
		if mid == start:
			return mid
		elif arr[mid - 1] <= val:
			return mid
		else:
			return bs_first_greater(arr, start, mid - 1, val)
	else:
		return bs_first_greater(arr, mid + 1, end, val)
ans = []
for i in range(m):
	val = b[i]
	temp = bs_first_greater(a, 0, n - 1, val)
	if temp == -1:
		ans.append(n)
	else:
		ans.append(temp)
print(*ans)


(m, n) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
d = {}
aa = sorted(a)
for i in aa:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
t = {}
for i in b:
	t[i] = 0
c = list(d.keys())
for i in range(1, len(c)):
	d[c[i]] = d[c[i]] + d[c[i - 1]]
p = list(sorted(d.keys()))
q = list(sorted(t.keys()))
i = 0
j = 0
while i < len(q):
	while j < len(p) and q[i] >= p[j]:
		t[q[i]] = d[p[j]]
		j += 1
	if t[q[i]] == 0:
		t[q[i]] = t[q[i - 1]]
	i += 1
for i in b:
	print(t[i], end=' ')


p = lambda : map(int, input().split())
g = lambda h: sorted(h)
(a, b) = p()
c = g(p())
d = [*p()]
e = g(set(d))
z = 0
(i, j, t) = (0, 0, len(e))
o = {}
while i < t:
	if j < a:
		try:
			while c[j] <= e[i]:
				j += 1
		except:
			pass
		o[e[i]] = j
	else:
		o[e[i]] = j
	i += 1
for i in d:
	print(o[i], end=' ')


import os
import sys
import math
from io import BytesIO, IOBase
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def dijkstra(start, distance, path, n):
	visited = [False for _ in range(n)]
	distance[start] = 0
	for i in range(n):
		v = -1
		for j in range(n):
			if not visited[v] and (v == -1 or distance[j] < distance[v]):
				v = j
		if distance[v] == math.inf:
			break
		visited[v] = True
		for edge in adj[v]:
			destination = edge[0]
			weight = edge[1]
			if distance[v] + weight < distance[destination]:
				distance[destination] = distance[v] + weight
				path[destination] = v

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def ncr(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def npr(n, r):
	return math.factorial(n) // math.factorial(n - r)

def seive(n):
	primes = [True] * (n + 1)
	ans = []
	for i in range(2, n):
		if not primes[i]:
			continue
		j = 2 * i
		while j <= n:
			primes[j] = False
			j += i
	for p in range(2, n + 1):
		if primes[p]:
			ans += [p]
	return ans

def factors(n):
	factors = []
	x = 1
	while x * x <= n:
		if n % x == 0:
			if n // x == x:
				factors.append(x)
			else:
				factors.append(x)
				factors.append(n // x)
		x += 1
	return factors

def main():
	try:
		(n, m) = invr()
		a = sorted(inlt())
		b = inlt()
		ans = []
		from bisect import bisect_left, bisect_right
		for i in range(m):
			ans.append(bisect_right(a, b[i]))
		print(*ans, sep=' ')
	except Exception as e:
		print(e)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
(n, m) = [int(x) for x in sys.stdin.readline().strip().split(' ')]
a = [int(x) for x in sys.stdin.readline().strip().split(' ')]
b = [int(x) for x in sys.stdin.readline().strip().split(' ')]
a.sort()
b = [(x, i) for (i, x) in enumerate(b)]
b.sort()
res = []
pos = 0
for (x, i) in b:
	while len(a) > pos and x >= a[pos]:
		pos += 1
	res.append((i, pos))
res.sort()
print(' '.join([str(x) for (_, x) in res]))


(n, m) = map(int, input().split())
a = [i for i in map(int, input().split())]
b = [i for i in map(int, input().split())]
new_a = []
for i in range(n):
	new_a.append((i, a[i]))
new_a = sorted(new_a, key=lambda x: x[1])
new_b = []
for j in range(m):
	new_b.append((j, b[j]))
new_b = sorted(new_b, key=lambda x: x[1])
result = [0] * m
i = 0
j = 0
count_j = 0
while j < m and i < n:
	if new_a[i][1] <= new_b[j][1]:
		count_j += 1
		i += 1
	else:
		result[new_b[j][0]] = count_j
		j += 1
if i == n:
	diff = m - j
	for k in range(j, m):
		result[new_b[k][0]] = n
print(*result)


def bs(a, key, n):
	i = 0
	j = n
	if a[0] > key:
		return -1
	if a[n - 1] <= key:
		return n - 1
	while i <= j:
		mid = (i + j) // 2
		if a[mid] == key and (mid + 1 == n or a[mid + 1] != key):
			return mid
		if a[mid] < key and a[mid + 1] > key:
			return mid
		elif a[mid] > key:
			j = mid - 1
		else:
			i = mid + 1
	return mid
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
d = dict()
for i in range(m):
	if b[i] in d:
		ind = d[b[i]]
	else:
		ind = bs(a, b[i], n)
		ind += 1
		d[b[i]] = ind
	print(ind, end=' ')


import bisect
I = lambda : int(input())
IL = lambda : list(map(int, input().split()))
IF = lambda : list(map(float, input().split()))
(n, m) = IL()
A = sorted(IL())
B = IL()
print(*[bisect.bisect_right(A, b) for b in B])


def main():
	input()
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = [(a[i], 'a') for i in range(len(a))]
	c.extend([(b[i], 'b') for i in range(len(b))])
	c.sort(key=lambda x: x[0])
	more_then = {}
	count = 0
	for i in range(len(c)):
		if c[i][1] == 'b':
			more_then[c[i][0]] = i - count
			count += 1
	ans = []
	for i in range(len(b)):
		ans.append(more_then[b[i]])
	print(' '.join(map(str, ans)))
main()


read = lambda : map(int, input().split())
(n, m) = read()
a = sorted(read())
b = list(read())
ans = [0] * m
b = sorted(((b[i], i) for i in range(m)))
i = 0
for j in range(m):
	while i < n and a[i] <= b[j][0]:
		i += 1
	ans[b[j][1]] = i
print(*ans)


(ans1, ans2) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l1.sort()
import bisect as ror
for y in l2:
	print(ror.bisect_right(l1, y), end=' ')


nm = [int(i) for i in input().split(' ')]
a = [int(i) for i in input().split(' ')]
b = [int(i) for i in input().split(' ')]
bOrig = b.copy()
a.sort()
b.sort()
menores = [0]
final = {}
for i in b:
	m = menores[-1]
	for j in range(menores[-1], nm[0]):
		if i >= a[j]:
			m += 1
		else:
			break
	final[str(i)] = m
	menores.append(m)
menores.pop(0)
for i in bOrig:
	print('%d' % final[str(i)], end=' ')


from sys import stdin, stdout
from collections import *
from math import gcd, floor, ceil
from bisect import bisect_right
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():

	def BIN(l, x):
		(left, right) = (0, n - 1)
		while left <= right:
			mid = left + right >> 1
			if l[mid] > x and (l[mid - 1] <= x or mid == 0):
				return mid
			if l[mid] <= x:
				left = mid + 1
			else:
				right = mid - 1
		return left
	(n, q) = mp()
	l = li()
	k = li()
	l.sort()
	ans = [BIN(l, i) for i in k]
	print(*ans)
for _ in range(1):
	solve()


import datetime
import bisect
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for i in b:
	(print(bisect.bisect(a, i), end=' '),)


import sys
input = sys.stdin.readline

def int_array():
	return list(map(int, input().split()))
(n, m) = int_array()
a = int_array()
b = int_array()
for i in range(m):
	b[i] = (b[i], i)
a.sort()
b.sort()
i = j = 0
ans = []
while i < n and j < m:
	if a[i] <= b[j][0]:
		i += 1
	else:
		ans.append((b[j][1], i))
		j += 1
while len(ans) < m:
	ans.append((b[j][1], i))
	j += 1
ans.sort()
answer = [ans[i][1] for i in range(m)]
print(*answer)


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.sort()
import bisect
ans = []
for b in B:
	j = bisect.bisect_right(A, b)
	ans.append(j)
print(*ans)


import bisect
(n, m) = list(map(int, input().split()))
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a1.sort()
for i in a2:
	print(bisect.bisect_right(a1, i), '', end='')


(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

def b_search(arr, size, x):
	p = size
	low = 0
	high = size - 1
	while low <= high:
		mid = low + (high - low) // 2
		if arr[mid] <= x:
			low = mid + 1
		else:
			p = mid
			high = mid - 1
	return p
a.sort()
for i in b:
	r = b_search(a, n, i)
	print(r, end=' ')


(n, m) = list(map(int, input().split()))
l = list(map(int, input().split()))
l1 = list(map(int, input().split()))
l = sorted(l)
from bisect import *
for e in l1:
	print(bisect_right(l, e), end=' ')


import bisect

def solution():
	(n, m) = map(int, input().strip().split())
	a = list(map(int, input().strip().split()))
	b = list(map(int, input().strip().split()))
	a.sort()
	for i in range(m - 1):
		print(bisect.bisect_right(a, b[i]), end=' ')
	print(bisect.bisect_right(a, b[m - 1]))
solution()


import sys
import bisect
input = sys.stdin.readline
(a, b) = list(map(int, input().split()))
arr = list(map(int, input().split()))
brr = list(map(int, input().split()))
arr.sort()
brrr = []
for i in range(b):
	brrr.append(str(bisect.bisect_left(arr, brr[i] + 1)))
print(' '.join(brrr))


(n, m) = [int(x) for x in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
a.sort()
c = []
for i in range(m):
	l = -1
	r = n
	q = 0
	while r > l + 1:
		q = (l + r) // 2
		if a[q] <= b[i]:
			l = q
		else:
			r = q
	c.append(r)
print(' '.join([str(x) for x in c]))


(n, m) = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))

def ub(x):
	lo = -1
	hi = n
	while lo + 1 < hi:
		mid = (lo + hi) // 2
		if x >= a[mid]:
			lo = mid
		else:
			hi = mid
	return hi
c = []
for e in b:
	c.append(ub(e))
print(*c)


from bisect import *
(a, b) = map(int, input().split())
lista1 = list(map(int, input().split()))
lista2 = list(map(int, input().split()))
lista1.sort()
for c in lista2:
	print(bisect_right(lista1, c), end=' ')


import bisect
(n, m) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
a.sort()
ans = []
for i in b:
	ans.append(bisect.bisect(a, i))
print(str(ans).replace('[', '').replace(']', '').replace(',', ''))


import bisect
(n, m) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
a.sort()
my_list = []
for i in b:
	my_list.append(bisect.bisect(a, i))
print(' '.join((str(j) for j in my_list)))


def binarySearch(arr, l, r, key):
	left = l
	right = r
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count
(n, m) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
a.sort()
for i in range(m):
	print(binarySearch(a, 0, len(a) - 1, b[i]), end=' ')


import sys
from bisect import bisect_right

def solve(a, b):
	if len(a) == 0 or len(b) == 0:
		return ['0'] * len(b)
	a.sort()
	result = ['0'] * len(b)
	(a_index, b_index) = (0, 0)
	while b_index < len(b) and a_index < len(a):
		b_value = b[b_index]
		index = bisect_right(a, b_value)
		if index:
			result[b_index] = str(index)
		b_index += 1
	return result
assert solve([1, 3, 5, 7, 9], [6, 4, 2, 8]) == ['3', '2', '1', '4']
assert solve([1, 2, 1, 2, 5], [3, 1, 4, 1, 5]) == ['4', '2', '4', '2', '5']
(a_length, b_length) = map(int, input().strip().split(' '))
a = list(map(int, input().strip().split(' ')))
b = list(map(int, input().strip().split(' ')))
print(' '.join(solve(a, b)))


import os, sys
from io import IOBase, BytesIO
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'
import bisect

def solve():
	(n, m) = map(int, input().split())
	n_arr = list(map(int, input().split()))
	m_arr = list(map(int, input().split()))
	n_arr.sort()
	res = []
	for idx in range(len(m_arr)):
		res.append(bisect.bisect_right(n_arr, m_arr[idx]))
	cout << ' '.join(map(str, res)) << endl

def main():
	solve()
main()


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = [(int(e), i) for (i, e) in enumerate(input().split())]
A.sort()
B.sort()
ans = [0] * m
i = j = 0
while j < m:
	while i < n and A[i] <= B[j][0]:
		i += 1
	ans[B[j][1]] = i
	j += 1
print(*ans)


(n, m) = map(int, input().split())
s = list(map(int, input().split()))
s.sort()
t = list(map(int, input().split()))
t = list(enumerate(t))
t.sort(key=lambda x: x[1])
from bisect import bisect
k = 0
lis = []
for i in range(m):
	k = bisect(s, t[i][1], k)
	lis.append(k)
l1 = [i[0] for i in t]
l = list(zip(lis, l1))
l.sort(key=lambda x: x[1])
print(*[i[0] for i in l])


from bisect import bisect_right
(n, m) = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
B = list(map(int, input().split()))
for i in B:
	print(bisect_right(A, i))


from bisect import bisect_right
x = input()
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
a = sorted(a)
for i in b:
	print(bisect_right(a, i), end=' ')


import bisect
(n, m) = map(int, input().split())
arr = []
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for i in b:
	ind = bisect.bisect(a, i)
	arr.append(ind)
print(*arr)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = b.copy()
a.sort()
c.sort()
i = 0
d = {}
for j in c:
	while i < len(a) and j >= a[i]:
		i = i + 1
	d[j] = i
ans = []
for i in b:
	ans.append(d[i])
print(*ans)


from bisect import *
I = lambda : map(int, input().split())
I()
l = sorted(I())
for e in I():
	print(bisect_right(l, e), end=' ')


(n, m) = map(int, input().split())
a = [*map(int, input().split())]
b = [*map(int, input().split())]
a.sort()
s = set(a)
from bisect import bisect_left, bisect_right
ans = []
for i in b:
	ans.append(bisect_left(a, i) if i not in s else bisect_right(a, i))
print(*ans)


import bisect
(n, m) = map(int, input().split())
l = sorted(list(map(int, input().split())))
s = list(map(int, input().split()))
for i in s:
	print(bisect.bisect(l, i), end=' ')


(n, m) = map(int, input().split())
a = [int(k) for k in input().split()]
b = [int(k) for k in input().split()]
z = []
a.sort()

def bi(g, n, a):
	l = 0
	r = n - 1
	while r - l > 1:
		mid = (r + l) // 2
		if a[mid] <= g:
			l = mid
		else:
			r = mid
	if a[l] > g:
		return l
	elif a[r] <= g:
		return r + 1
	return r
for i in b:
	if n > 2:
		z.append(bi(i, n, a))
	elif i >= max(a):
		z.append(n)
	elif i >= min(a):
		z.append(n - 1)
	else:
		z.append(0)
print(*z)


(n, m) = map(int, input().split())
arr = sorted(list(map(int, input().split())))
queries = list(map(int, input().split()))

def bin_search(v):
	le = 0
	r = n - 1
	while le <= r:
		mid = (le + r) // 2
		if arr[mid] > v:
			if mid > 0:
				if arr[mid - 1] <= v:
					return mid
			else:
				return mid
			r = mid
		else:
			le = mid + 1
	return le
ans = []
for q in queries:
	ans.append(str(bin_search(q)))
print(' '.join(ans))


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
l1 = list(map(int, input().split()))
from bisect import bisect_left as bl, bisect_right as br
for i in l1:
	print(br(l, i), end=' ')


import unittest
import sys

def rbound(v, n):
	b = 0
	e = len(v)
	while b != e:
		mid = (b + e + 1) // 2
		if v[mid - 1] <= n:
			b = mid
		else:
			e = mid - 1
	return b

class Query:

	def __init__(self, test_inputs=None):
		it = iter(test_inputs.split('\n')) if test_inputs else None

		def uinput():
			return next(it) if it else sys.stdin.readline().rstrip()
		[self.n, self.m] = map(int, uinput().split())
		self.numa = list(map(int, uinput().split()))
		self.numb = list(map(int, uinput().split()))
		self.snuma = sorted(self.numa)

	def calculate(self):
		result = []
		for n in self.numb:
			result.append(rbound(self.snuma, n))
		return str(' '.join(map(str, result)))

class unitTests(unittest.TestCase):

	def test_single_test(self):
		test = '5 4\n1 3 5 7 9\n6 4 2 8'
		d = Query(test)
		self.assertEqual(d.n, 5)
		self.assertEqual(d.m, 4)
		self.assertEqual(Query(test).calculate(), '3 2 1 4')
		test = '5 5\n1 2 1 2 5\n3 1 4 1 5'
		self.assertEqual(Query(test).calculate(), '4 2 4 2 5')
		test = ''
		test = ''

	def time_limit_test(self, nmax):
		import random
		import timeit
		test = str(nmax) + ' ' + str(nmax) + '\n'
		numnums = [str(i) + ' ' + str(i + 1) for i in range(nmax)]
		test += '\n'.join(numnums) + '\n'
		nums = [random.randint(1, 10000) for i in range(nmax)]
		test += ' '.join(map(str, nums)) + '\n'
		start = timeit.default_timer()
		d = Query(test)
		calc = timeit.default_timer()
		d.calculate()
		stop = timeit.default_timer()
		print('\nTimelimit Test: ' + '{0:.3f}s (init {1:.3f}s calc {2:.3f}s)'.format(stop - start, calc - start, stop - calc))
sys.setrecursionlimit(100000)
if sys.argv[-1] == '-ut':
	unittest.main(argv=[' '])
sys.stdout.write(Query().calculate())


import bisect

def less_than_or_equal(x, y):
	x.sort()
	queries = {}
	res = []
	for num in y:
		if num in queries:
			res.append(queries[num])
		else:
			ind = bisect.bisect(x, num)
			res.append(ind)
			queries[num] = ind
	return ' '.join((str(x) for x in res))
_ = input()
x = [int(x) for x in input().split()]
y = [int(y) for y in input().split()]
print(less_than_or_equal(x, y))


import bisect
(n, m) = map(int, input().split())
ar = list(map(int, input().split()))
br = list(map(int, input().split()))
ar.sort()
for i in br:
	print(bisect.bisect(ar, i, 0, n), end=' ')


import bisect
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
ans = [0] * m
for i in range(m):
	ans[i] = bisect.bisect_right(a, b[i])
print(*ans)


import bisect as bi
n = input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
x = []
for i in b:
	x.append(bi.bisect(a, i))
print(*x)


from collections import defaultdict as dd
(a, b) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
m = sorted(l1)
n = sorted(l2)
d = dd(lambda : 0)
start = 0
for i in n:
	r = 0
	for j in range(start, a):
		if i >= m[j]:
			r += 1
		else:
			break
	start += r
	d[i] = start
for i in l2:
	print(d[i], end=' ')
print()


def solve(a, n, item):
	(l, h) = (0, n)
	while h - l > 1:
		m = (h + l) // 2
		if a[m] <= item:
			l = m
		else:
			h = m
	if l == 0 and a[l] > item:
		return l
	return l + 1
(n, m) = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
ans = []
for i in b:
	ans.append(solve(a, n, i))
print(*ans)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
ans = []
for i in b:
	l = 0
	r = n - 1
	x = i
	ind = 0
	while l <= r:
		mid = (r + l) // 2
		if a[mid] <= x:
			l = mid + 1
			ind = mid + 1
		else:
			r = mid - 1
	ans.append(ind)
for i in ans:
	print(i, end=' ')


from sys import stdin, stdout
import bisect

def ii():
	return int(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline()
(a, b) = mi()
l1 = li()
l2 = li()
l1.sort()
for i in l2:
	print(bisect.bisect(l1, i), end=' ')


import sys
from bisect import bisect_right as rb
from collections import deque
from queue import PriorityQueue
from math import gcd
from math import log
from math import ceil
from math import pi
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
mod = 10 ** 9 + 7
(n, m) = il()
a = il()
b = il()
ans = []
a.sort()
for i in range(m):
	x = rb(a, b[i])
	ans.append(x)
print(*ans)


from sys import stdin, stdout

def b_s(arr, target):
	l = -1
	r = len(arr)
	m = (l + r) // 2
	while l + 1 < r:
		if arr[m] > target:
			r = m
			m = (l + r) // 2
		else:
			l = m
			m = (l + r) // 2
	return r
outputs = []
(n, m) = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
B = list(map(int, input().split()))
for element in B:
	outputs.append(b_s(A, element))
for output in outputs:
	print(output)


(m, n) = map(int, input().split())
arr_a = list(map(int, input().split()))
arr_b = list(map(int, input().split()))
ans = []
arr_a.sort()

def bfs(arr, x):
	l = 0
	r = len(arr) - 1
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] > x:
			r = mid - 1
		else:
			l = mid + 1
	return l
arr = [1, 3, 5, 7, 9]
for i in arr_b:
	ans.append(bfs(arr_a, i))
for i in ans:
	print(i, end=' ')


from bisect import *
(m, n) = map(int, input().split())
a = list(sorted(map(int, input().split())))
b = list(map(int, input().split()))
print(*(bisect(a, b[j]) for j in range(n)))


(n, m) = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
d = {i: 0 for i in b}
for i in d:
	l = 0
	h = n
	f = 0
	while l < h:
		mid = (l + h) // 2
		if a[mid] == i:
			while mid < n and a[mid] == i:
				mid += 1
			d[i] = mid
			f = 1
			break
		elif a[mid] < i:
			l = mid + 1
		else:
			h = mid
	if f == 0:
		d[i] = l
print(*[d[i] for i in b])


a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.sort()
c = list(map(int, input().split()))
v = []
for i in range(a[1]):
	l = -1
	r = a[0]
	g = c[i]
	while l + 1 < r:
		m = (l + r) // 2
		if b[m] <= g:
			l = m
		else:
			r = m
	print(r, end=' ')


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
l = 0
h = n
aa = []
for i in range(0, m):
	while h - l > 1:
		mid = (l + h) // 2
		if a[mid] <= b[i]:
			l = mid
		elif a[mid] > b[i]:
			h = mid
	if a[l] > b[i]:
		aa.append(0)
	else:
		aa.append(l + 1)
	l = 0
	h = n
print(*aa)


def queries():
	(arr1Size, arr2Size) = map(int, input().split())
	arr1 = sorted([int(s) for s in input().split()])
	arr2 = [int(s) for s in input().split()]
	output = []
	low = 0
	high = arr1Size - 1
	a = 0
	for i in range(len(arr2)):
		low = 0
		high = arr1Size - 1
		a = 0
		while low <= high:
			mid = low + (high - low) // 2
			if arr1[mid] <= arr2[i]:
				a = mid + 1
				low = mid + 1
			else:
				high = mid - 1
		output.append(a)
	print(' '.join((str(i) for i in output)))
queries()


import bisect
input()
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
A = sorted(a)
temp = []
for i in b:
	temp.append(bisect.bisect_right(A, i))
print(*temp)


from sys import stdin, stdout, setrecursionlimit

class Tail_Recursion_Optimization:

	def __init__(self, RECURSION_LIMIT, STACK_SIZE):
		setrecursionlimit(RECURSION_LIMIT)
		threading.stack_size(STACK_SIZE)
		return None

class SOLVE:

	def solve(self):
		R = stdin.readline
		W = stdout.write
		ans = []
		(n, m) = [int(x) for x in R().split()]
		a = [int(x) for x in R().split()]
		b = [int(x) for x in R().split()]
		a.sort()
		for j in range(m):
			(low, high, mx) = (0, n - 1, 0)
			while low <= high:
				mid = (low + high) // 2
				if a[mid] <= b[j]:
					mx = max(mx, mid + 1)
					low = mid + 1
				else:
					high = mid - 1
			ans.append(str(mx))
		W(' '.join(ans))
		return 0

def main():
	s = SOLVE()
	s.solve()
main()


import bisect

def calculate(x, y, size):
	l = list()
	for i in range(size):
		l.append(bisect.bisect_right(x, y[i]))
	return l
(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a.sort()
result = calculate(a, b, m)
print(*result)


import bisect
args = input().split()
size_a = int(args[0])
size_b = int(args[1])
a = input().split()
b = input().split()
for i in range(len(a)):
	a[i] = int(a[i])
for i in range(len(b)):
	b[i] = int(b[i])
a = sorted(a)
ans = []
for x in b:
	ans.append(bisect.bisect(a, x))
print(' '.join(map(str, ans)))


(x, y) = input().split()
x_list = sorted([int(i) for i in input().split()])
y_list = [int(j) for j in input().split()]
output = []

def binary_search(Array, Search_Term):
	R = len(Array) - 1
	L = 0
	while L <= R:
		mid = (L + R) // 2
		if Array[mid] <= Search_Term:
			L = mid + 1
		else:
			R = mid - 1
	return L
for num_to_compare in y_list:
	output.append(binary_search(x_list, num_to_compare))
print(*output, sep=' ')


def bin_search(arr, n, x):
	l = 0
	h = n - 1
	while l <= h:
		mid = int((l + h) / 2)
		if arr[mid] <= x:
			l = mid + 1
		else:
			h = mid - 1
	return h

def countElements(arr1, arr2, m, n):
	arr1.sort()
	ans = []
	for i in range(m):
		index = bin_search(arr1, n, arr2[i])
		ans.append(index + 1)
	return ans
new = list(map(int, input().split()))
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
n = new[0]
m = new[1]
ans = []
ans = countElements(arr1, arr2, m, n)
print(*ans)


import math
from collections import defaultdict

def Bins(listo, item):
	low = 0
	high = len(listo) - 1
	ans = 0
	while low <= high:
		mid = (low + high) // 2
		guess = listo[mid]
		if guess <= item:
			low = mid + 1
		elif guess > item:
			high = mid - 1
	return low
for _ in range(1):
	(n, m) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	ch = list(map(int, input().split()))
	a.sort()
	for i in range(m):
		ans = Bins(a, ch[i])
		print(ans, end=' ')
	print()


(n, m) = map(int, input().split())
(x, y) = (list(map(int, input().split())), list(map(int, input().split())))
x.sort()
for i in y:
	(l, h) = (0, len(x) - 1)
	while l <= h:
		m = (l + h) // 2
		if i < x[m]:
			h = m - 1
		else:
			l = m + 1
	print(h + 1, end=' ')


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(len(b)):
	b[i] = [b[i], 0, i]
a.sort()
b.sort(key=lambda b: b[0])
a_ptr = 0
for i in range(len(b)):
	while a_ptr < n and a[a_ptr] <= b[i][0]:
		a_ptr += 1
	b[i][1] = a_ptr
b.sort(key=lambda b: b[2])
for bi in b:
	print(bi[1], end=' ')


from bisect import bisect_left
import collections

def fun(nums1, nums2):
	nums1.sort()
	lis = []
	dic = collections.Counter(nums1)
	index = {}
	for j in range(len(nums1)):
		if nums1[j] not in index.keys():
			index[nums1[j]] = j
	for i in range(len(nums2)):
		num = bisect_left(nums1, nums2[i])
		n = dic[nums2[i]]
		if n != 0:
			num = index[nums2[i]]
			lis.append(num + n)
			continue
		lis.append(num)
	return lis
(var1, var2) = [int(x) for x in input().split()]
user_input = input().split(' ')
list1 = [int(x.strip()) for x in user_input]
user_input = input().split(' ')
lsit2 = [int(x.strip()) for x in user_input]
print(*fun(list1, lsit2))


list1 = list
(m, n) = list1(map(int, input().split()))
list1 = [int(x) for x in input().split()]
list2 = [int(x) for x in input().split()]
list1.sort()

def finding_Queries(list1, element):
	(low, high) = (0, len(list1) - 1)
	while low <= high:
		mid = low + (high - low) // 2
		if list1[mid] > element:
			high = mid - 1
		else:
			low = mid + 1
	return high
for i in list2:
	index = finding_Queries(list1, i)
	print(index + 1, end=' ')


(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
a.sort()

def find(k):
	global a
	start = 0
	end = len(a) - 1
	while start < end:
		mid = (start + end) // 2
		if a[mid] > k:
			end = mid - 1
		else:
			start = mid + 1
	if a[start] <= k:
		start += 1
	return start
ans = []
for i in b:
	ans.append(str(find(i)))
print(' '.join(ans))


def bins(arr, key):
	start = 0
	count = 0
	end = len(arr) - 1
	while start <= end:
		mid = int((start + end) / 2)
		if arr[mid] <= key:
			count = mid + 1
			start = mid + 1
		else:
			end = mid - 1
	return count

def main():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	for j in range(len(b)):
		print(bins(a, b[j]), end=' ')
main()


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ta = sorted(a)
tb = sorted(b)
dic = {}
i = 0
j = 0
c = 0
while i < n and j < m:
	if ta[i] <= tb[j]:
		c = c + 1
		i = i + 1
	else:
		dic[tb[j]] = c
		j = j + 1
if i == n and ta[i - 1] <= tb[j]:
	dic[tb[j]] = c
if j < m:
	for k in range(j + 1, m):
		dic[tb[k]] = dic[tb[j]]
for i in b:
	print(dic[i], end=' ')


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
(n, m) = zz()
l = szzz()
ans = []
for i in zzz():
	ans.append(bs(l, i))
for i in ans:
	print(i)


import bisect
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for i in b:
	right = bisect.bisect_right(a, i, 0, n)
	print(right, end=' ')


def binarysearch(a, b):
	x = 0
	y = len(a) - 1
	count = 0
	while x <= y:
		m = x + (y - x) // 2
		if a[m] <= b:
			count += m + 1 - x
			x = m + 1
		else:
			y = m - 1
	return count
(m, n) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
c = []
for item in b:
	c.append(binarysearch(a, item))
print(' '.join((str(ele) for ele in c)))


import bisect
(a, b) = [int(x) for x in input().split()]
a_list = [int(x) for x in input().split()]
b_list = [int(x) for x in input().split()]
a_list.sort()
for i in b_list:
	p = bisect.bisect(a_list, i, lo=0, hi=len(a_list))
	print(p)


(m, n) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
st = b.copy()
a.sort()
b.sort()
cnt = 0
ans = {}
pos = 0
for ctr in range(len(b)):
	while pos < m and a[pos] <= b[ctr]:
		pos += 1
	ans[b[ctr]] = pos
for val in st:
	print(ans[val], end=' ')


from bisect import bisect_right
(n, m) = map(int, input().split())
a = sorted(map(int, input().split()))
print(*(bisect_right(a, i) for i in map(int, input().split())))


import bisect
(n, m) = map(int, input().split())
a = list(sorted(list(map(int, input().split()))))
b = list(map(int, input().split()))
r = []
for bb in b:
	i = bisect.bisect_right(a, bb)
	r.append(str(i))
print(' '.join(r))


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def find_parent(parent, i, cnt):
	cnt += 1
	if parent[i - 1] == i:
		return cnt
	if parent[i - 1] != i:
		find_parent(parent, parent[i - 1], cnt)
from collections import Counter
from collections import Counter
import math
from bisect import bisect_right
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
ls = list(map(int, input().split()))
for i in range(k):
	var = bisect_right(arr, ls[i])
	print(var, end=' ')


def upper_bound(A, bi):
	front = 0
	back = len(A) - 1
	idx_UB = 0
	while front <= back:
		mid = (front + back) // 2
		if A[mid] > bi:
			back = mid - 1
			idx_UB = mid
		elif A[mid] <= bi:
			front = mid + 1
			idx_UB = mid + 1
	return idx_UB

def write_response(result):
	print(' '.join(map(str, result)))

def solve(A, B):
	A.sort()
	result = []
	for bi in B:
		idx_UB = upper_bound(A, bi)
		result.append(idx_UB)
	write_response(result)
(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
solve(A, B)


def bs(e, arr):
	l = 0
	r = n - 1
	ans = -1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] <= e:
			ans = mid
			l = mid + 1
		else:
			r = mid - 1
	if ans == -1:
		return 0
	return ans + 1
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = sorted(a)
ans = []
for i in range(m):
	e = b[i]
	k = bs(e, a)
	ans.append(k)
print(*ans)


import bisect
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for num in b:
	print(bisect.bisect_right(a, num), ' ', sep='', end='')


import bisect
(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a.sort()
arr = list()
for i in range(m):
	arr.append(bisect.bisect_right(a, b[i]))
print(*arr)


import bisect
entrada = input().split()
(tamanhoA, tamanhoB) = (int(entrada[0]), int(entrada[1]))
a = [int(i) for i in input().split()]
a.sort()
b = [int(i) for i in input().split()]
c = []
print(bisect.bisect_right(a, b[0]), end='')
for i in range(1, tamanhoB):
	print('', bisect.bisect_right(a, b[i]), end='')
print()


import sys
import os.path
from collections import *
import math
import bisect
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = sys.stdin.readline
(n, m) = [int(x) for x in input().split()]
arr1 = [int(x) for x in input().split()]
arr2 = [int(x) for x in input().split()]
arr1.sort()
for i in arr2:
	print(bisect.bisect_right(arr1, i), end=' ')


from bisect import bisect_right
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
b = list(map(int, input().split()))

def f(k):
	lo = 0
	hi = len(a) - 1
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] > k:
			hi = mid - 1
			if a[hi] <= k:
				hi += 1
		elif a[mid] <= k:
			lo = mid + 1
	return lo + (1 if a[lo] == k else 0)
x = []
for i in b:
	x.append(bisect_right(a, i))
print(*x)


def bs(k):
	global n
	l = 0
	r = n
	while l < r:
		mid = (l + r) // 2
		if k >= a[mid]:
			if mid == n - 1:
				return mid + 1
			if k < a[mid + 1]:
				return mid + 1
		if k < a[mid]:
			r = mid
		else:
			l = mid + 1
	return mid
(n, m) = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
for k in b:
	print(bs(k), end=' ')


class array:

	def __init__(self, value, id):
		self.value = value
		self.id = id
(n, m) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
a = []
for i in range(n):
	a.append(array(x[i], i))
b = []
for i in range(m):
	b.append(array(y[i], i))
a.sort(key=lambda arr: arr.value)
b.sort(key=lambda arr: arr.value)
i = 0
res = [0] * m
for x in b:
	while i < n:
		if a[i].value <= x.value:
			i += 1
		else:
			break
	res[x.id] = i
for x in res:
	print(x, end=' ')


import sys
(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()

def findPos(arr, l, r, x):
	m = 0
	while l <= r:
		m = (l + r) // 2
		if arr[m] <= x:
			l = m + 1
		else:
			r = m - 1
	return l
ans = []
for x in b:
	ans.append(str(findPos(a, 0, n - 1, x)))
print(' '.join(ans))


import sys
from math import gcd, sqrt
sys.setrecursionlimit(10 ** 5)
inf = float('inf')
en = lambda x: list(enumerate(x))
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
(a, b) = r()
arr = rr()
arr.sort()
brr = rr()
brr = en(brr)
brr.sort(key=lambda x: x[1])
ans = [0] * b
x = 0
for (i, j) in brr:
	while x < a and arr[x] <= j:
		x += 1
	ans[i] = x
print(*ans)


import math as mt
import sys, string
input = sys.stdin.readline
import random
from collections import deque, defaultdict
import bisect
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())

def find_le(a, x):
	i = bisect.bisect_right(a, x)
	if i:
		return i - 1
	return -1
(n, m) = M()
l = L()
y = L()
d = defaultdict(int)
for i in l:
	d[i] += 1
l = list(set(l))
l.sort()
x = [d[l[0]]]
for i in range(1, len(l)):
	x.append(x[-1] + d[l[i]])
for i in y:
	w = find_le(l, i)
	if w == -1:
		print(0, end=' ')
	else:
		print(x[w], end=' ')


import bisect as bt

def main():
	outputs = []
	(n, m) = map(int, input().split())
	A = sorted([int(num) for num in input().split()])
	B = [int(num) for num in input().split()]
	for element in B:
		outputs.append(bt.bisect(A, element))
	for output in outputs:
		print(output)
main()


(n, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [[int(i), 0] for i in input().split()]
for i in range(m):
	b[i][1] = i
a.sort()
b.sort(key=lambda x: x[0])
ress = [0] * m
i = j = 0
res = 0
while i < len(a) and j < len(b):
	if a[i] <= b[j][0]:
		res += 1
		i += 1
	else:
		ress[b[j][1]] = res
		j += 1
while j < len(b):
	ress[b[j][1]] = res
	j += 1
for i in ress:
	print(i, end=' ')


import bisect
(n, m) = map(int, input().split())
l = [int(s) for s in input().split()]
l2 = [int(s) for s in input().split()]
l.sort()
for i in range(m):
	k = bisect.bisect_right(l, l2[i])
	print(k, end=' ')


(n, m) = list(map(int, input().strip().split()))
a = list(map(int, input().strip().split()))
c = input().strip().split()
b = [(int(c[x]), x) for x in range(m)]
a.sort()
b.sort()
result = ''
prev_result = 0
for i in range(m):
	count = prev_result
	while count < n and b[i][0] >= a[count]:
		count += 1
	c[b[i][1]] = str(count)
	prev_result = count
print(' '.join(c))


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
from collections import defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from bisect import *
(n, m) = map(int, input().split())
l = [*map(int, input().split())]
arr = [*map(int, input().split())]
l.sort()
for i in arr:
	print(bisect_right(l, i), end=' ')


import sys
import bisect
from bisect import bisect_left as lb
input_ = lambda : sys.stdin.readline().strip('\r\n')
from math import log
from math import gcd
from math import atan2, acos
from random import randint
sa = lambda : input_()
sb = lambda : int(input_())
sc = lambda : input_().split()
sd = lambda : list(map(int, input_().split()))
se = lambda : float(input_())
sf = lambda : list(input_())
flsh = lambda : sys.stdout.flush()
mod = 10 ** 9 + 7
gp = []
cost = []
dp = []
mx = []
ans1 = []
ans2 = []
special = []
specnode = []
a = 0
kthpar = []

def dfs(root, par):
	if par != -1:
		dp[root] = dp[par] + 1
	for i in range(1, 20):
		if kthpar[root][i - 1] != -1:
			kthpar[root][i] = kthpar[kthpar[root][i - 1]][i - 1]
	for child in gp[root]:
		if child == par:
			continue
		kthpar[child][0] = root
		dfs(child, root)

def hnbhai():
	(n, m) = sd()
	a = sd()
	b = sd()
	a.sort()
	for i in b:
		print(lb(a, i + 1), end=' ')
	print()
for _ in range(1):
	hnbhai()


import bisect
(m, n) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a = sorted(a)
for i in b:
	print(bisect.bisect(a, i), end=' ')


import bisect
x = input()
a = [int(j) for j in input().split()]
b = [int(j) for j in input().split()]
a = sorted(a)
coun = 0
for l in b:
	print(bisect.bisect(a, l), '', end='')


(a, b) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
a.sort()
bp = [[b[i], i, 0] for i in range(len(b))]
bp.sort()
a.append(10 ** 15)
ptr = 0
cum = 0
ind = 0
while ptr < len(a) and ind < len(bp):
	while bp[ind][0] >= a[ptr]:
		ptr += 1
	bp[ind][2] = ptr
	ind += 1
bp.sort(key=lambda x: x[1])
for i in bp:
	print(i[2], end=' ')


def bin_search(a, n, e):
	(l, r) = (0, n - 1)
	while l <= r:
		mid = (l + r) // 2
		if a[mid] > e:
			r = mid - 1
		else:
			l = mid + 1
	return l
(n, m) = map(int, input().split())
a = sorted(map(int, input().split()))
b = map(int, input().split())
result = []
for e in b:
	result.append(bin_search(a, n, e))
print(*result)


import bisect
x = input()
a = [int(j) for j in input().split()]
b = [int(j) for j in input().split()]
a = sorted(a)
for l in b:
	print(bisect.bisect_right(a, l), '', end='')


def solve(n, m, d, e):
	big = float('inf')
	small = float('-inf')
	d.sort()
	res = []
	for i in e:
		if i >= d[-1]:
			res.append(n)
			continue
		if i < d[0]:
			res.append(0)
			continue
		low = 0
		high = n - 1
		mid = (low + high) // 2
		flag = True
		while low < high:
			mid = (low + high) // 2
			if d[mid] <= i < d[mid + 1]:
				res.append(mid + 1)
				flag = False
				break
			elif d[mid] <= i:
				low = mid + 1
			else:
				high = mid
	return res

def main():
	t = input()
	t = [int(i) for i in t.split()]
	n = t[0]
	m = t[1]
	d = input()
	d = [int(i) for i in d.split()]
	e = input()
	e = [int(i) for i in e.split()]
	ans = solve(n, m, d, e)
	for i in ans:
		print(i, end=' ')
	print()
main()
n = 5
m = 1
a = [1, 3, 5, 7, 9]
b = [6, 4, 2, 8]


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from heapq import *
from math import gcd, factorial, floor, ceil
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 10 ** 9 + 7

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	(n, m) = sep()
	a = lis()
	b = lis()
	a = sorted(a)
	ans = []
	for i in range(len(b)):
		ans.append(br(a, b[i]))
	print(' '.join((str(ans[i]) for i in range(len(ans)))))
testcase(1)


import bisect
[n, m] = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
b = []
for i in range(m):
	b.append((c[i], i))
a = sorted(a)
b = sorted(b)
ans = [0 for i in range(m)]
for i in range(m):
	ans[b[i][1]] = int(bisect.bisect_right(a, b[i][0]))
for i in range(m):
	print(ans[i])


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
ans = [0] * m
for i in range(m):
	beg = 0
	end = n - 1
	while beg <= end:
		mid = (beg + end) // 2
		if mid == n - 1 and b[i] >= a[mid]:
			ans[i] = mid + 1
			break
		elif b[i] >= a[mid]:
			if b[i] >= a[mid + 1]:
				beg = mid + 1
			else:
				ans[i] = mid + 1
				break
		else:
			end = mid - 1
for i in range(m):
	print(ans[i], end=' ')


(a_num, b_num) = input().split()
a_num = int(a_num)
b_num = int(b_num)
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
b1 = b[:]
dic = {}
a.sort()
b.sort()
ans = []
pointer = 0
index = 0
while True:
	if index < a_num and pointer < b_num:
		if a[index] <= b[pointer]:
			index += 1
		else:
			dic[b[pointer]] = str(index)
			pointer += 1
	else:
		break
while pointer != b_num:
	dic[b[pointer]] = str(index)
	pointer += 1
for i in b1:
	ans.append(dic[i])
print(' '.join(ans))


def array():
	return [int(i) for i in input().split()]

def bs(a, k):
	l = 0
	h = len(a) - 1
	while l <= h:
		m = l + (h - l) // 2
		if a[m] > k and (a[m - 1] <= k or m == 0):
			return m
		elif a[m] <= k:
			l = m + 1
		else:
			h = m - 1
	return l
(n, k) = map(int, input().split())
a = array()
b = array()
a.sort()
ans = 0
for k in b:
	ans = bs(a, k)
	print(ans)


(n1, n2) = list(map(int, input().split()))
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = a2.copy()
a1.sort()
a2.sort()
k = 0
val = 0
d = {}
for i in range(n2):
	while val < n1 and a1[val] <= a2[i]:
		val += 1
	d[a2[i]] = val
for i in a3:
	print(d[i], end=' ')


n = [int(b) for b in input().split()]
A = [int(b) for b in input().split()]
B = [int(b) for b in input().split()]
A.sort()
Bo = B.copy()
B.sort()
me = [0]
resp = {}
for i in B:
	m = me[-1]
	for j in range(me[-1], n[0]):
		if i >= A[j]:
			m += 1
		else:
			break
	resp[i] = m
	me.append(m)
del me[0]
str = ''
for i in Bo:
	str += '{} '.format(resp[i])
print(str)


(m, n) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
ans = []
for j in range(n):
	(lo, hi) = (0, m)
	while lo < hi:
		mi = lo + hi >> 1
		if a[mi] <= b[j]:
			lo = mi + 1
		else:
			hi = mi
	ans.append(lo)
print(*ans)


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(set(b))
a.sort()
c.sort()
d = {}
(l, i, j) = (len(c), 0, 0)
while i < n and j < l:
	if a[i] <= c[j]:
		i = i + 1
		continue
	if a[i] > c[j]:
		d[c[j]] = i
		j = j + 1
while j < l:
	d[c[j]] = i
	j = j + 1
for i in b:
	print(d[i], end=' ')


from bisect import *
(x, y) = input().split()
y = int(y)
l = list(map(int, input().split()))[:]
m = list(map(int, input().split()))[:]
l.sort()
for i in m:
	print(bisect(l, i), end=' ')


def bin_(x, l, d):
	if x not in d:
		if x < l[0]:
			d[x] = 0
		elif x >= l[-1]:
			d[x] = len(l)
		else:
			b = 0
			e = len(l) - 1
			while b <= e:
				m = (b + e) // 2
				if m > 0 and a[m] > x and (a[m - 1] <= x):
					d[x] = m
					break
				elif a[m] > x:
					e = m - 1
				else:
					b = m + 1
	return d
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
c = []
d = {}
for i in range(m):
	d = bin_(b[i], a, d)
	c.append(d[b[i]])
print(*c)


def almost_binary_search(array, x):
	left = 0
	right = len(array) - 1
	index = 0
	while left <= right:
		mid = (left + right) // 2
		if array[mid] <= x:
			index = mid + 1
			left = mid + 1
		elif array[mid] > x:
			right = mid - 1
	return index
(n, m) = [int(i) for i in input().split()]
ls1 = [int(i) for i in input().split()]
ls2 = [int(i) for i in input().split()]
ls1.sort()
for i in range(len(ls2)):
	j = almost_binary_search(ls1, ls2[i])
	if i != len(ls2) - 1:
		print(j, end=' ')
	else:
		print(j, end='')


import bisect
(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = sorted(a)
c = [bisect.bisect_right(a, i) for i in b]
print(' '.join(map(str, c)))


(n, m) = map(int, input().split())
a = sorted(list(map(int, input().split())))
origB = list(map(int, input().split()))
b = sorted(origB)
counts = {}
c = 0
i = 0
j = 0
while i < n and j < m:
	if a[i] <= b[j]:
		c = c + 1
		i = i + 1
	else:
		counts[b[j]] = c
		j = j + 1
while j < m:
	counts[b[j]] = c
	j = j + 1
for j in origB:
	print(counts[j], end=' ')


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def sumDigits(no):
	return 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10))
MOD = 1000000007
PMOD = 998244353
N = 10 ** 5
T = 1
for _ in range(T):
	(n, m) = list(map(int, stdin.readline().rstrip().split()))
	a = list(map(int, stdin.readline().rstrip().split()))
	b = list(map(int, stdin.readline().rstrip().split()))
	a.sort()
	ans = []
	for i in range(m):
		ix = bisect_right(a, b[i])
		ans.append(ix)
	print(*ans)


from bisect import bisect_right
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for item in range(m):
	if bisect_right(a, b[item]):
		print(bisect_right(a, b[item]), end=' ')
	else:
		print(0, end=' ')


from bisect import bisect_right
(x, y) = map(int, input().split())
(*li1,) = map(int, input().split())
(*li2,) = map(int, input().split())
li1.sort()
li3 = []
for i in li2:
	li3.append(bisect_right(li1, i))
print(*li3)


[n, m] = list(map(int, input().strip().split()))
a = list(map(int, input().strip().split()))
b = list(map(int, input().strip().split()))
a.append(1000000001)
c = b.copy()
a.sort()
b.sort()
d = {}
i = 0
j = 0
while i < n + 1 and j < m:
	if a[i] > b[j]:
		d[b[j]] = i
		j += 1
	else:
		i += 1
res = [d[el] for el in c]
print(' '.join(map(str, res)))


from bisect import bisect_right
input()
a = sorted([int(i) for i in input().split()])
b = [int(i) for i in input().split()]
res = ''
for num in b:
	res += str(bisect_right(a, num)) + ' '
print(res)


l1 = input().strip().split(' ')
n = int(l1[0])
m = int(l1[1])
l2 = input().strip().split(' ')
lisa = []
for x in l2:
	lisa.append(int(x))
lisa.sort()
l3 = input().strip().split(' ')
lisb = []
for x in l3:
	lisb.append(int(x))

def bin_search(arr, n, x):
	l = 0
	h = n - 1
	while l <= h:
		mid = int((l + h) / 2)
		if arr[mid] <= x:
			l = mid + 1
		else:
			h = mid - 1
	return h
lisa.sort()
for i in range(m):
	index = bin_search(lisa, n, lisb[i])
	print(index + 1)


import bisect
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
i = 0
while i < len(b):
	ans = bisect.bisect_right(a, b[i])
	if ans >= 0 & ans < n:
		print(ans, end=' ')
	i += 1


(n, m) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = b.copy()
a.sort()
b.sort()
d = {}
i = 0
j = 0
count = 0
while i < n and j < m:
	if a[i] <= b[j]:
		count += 1
		i += 1
	else:
		d[b[j]] = count
		j += 1
for k in range(j, m):
	d[b[k]] = count
for x in c:
	print(d[x], end=' ')


(m, n) = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
out = [0 for _ in range(n)]
b = sorted([(i, x) for (i, x) in enumerate(b)], key=lambda x: (x[1], x[0]))
index_a = 0
index_b = 0
while index_a < m and index_b < n:
	if b[index_b][1] >= a[index_a]:
		index_a += 1
	else:
		out[b[index_b][0]] = str(index_a)
		index_b += 1
for x in range(index_b, n):
	out[b[x][0]] = str(index_a)
print(' '.join(out))


import bisect
(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
resultado = ''
for num in b:
	resultado += '%d ' % bisect.bisect_right(a, num)
print(resultado)


(n, m) = map(int, input().split())
lst = sorted(list(map(int, input().split())))
l1 = list(map(int, input().split()))
for d in l1:
	l = 0
	u = n - 1
	while l <= u:
		m = (l + u) // 2
		if lst[m] <= d:
			l = m + 1
		else:
			u = m - 1
	print(l, end=' ')


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
ii = lambda : int(input())
kk = lambda : map(int, input().split())
ll = lambda : list(kk())
(n, m) = kk()
(ns, ms) = (ll(), ll())
ms = list(enumerate(ms))
ns.sort()
ms.sort(key=lambda x: x[1])
(ni, ans) = (0, [-1] * m)
for s in ms:
	while ni < n and s[1] >= ns[ni]:
		ni += 1
	ans[s[0]] = ni
print(*ans)


def binarySearch(num, start, end, arr):
	if start >= end:
		return start
	midPoint = (start + end) // 2
	if arr[midPoint] <= num:
		return binarySearch(num, midPoint + 1, end, arr)
	else:
		return binarySearch(num, start, midPoint - 1, arr)

def solve(sizeA, sizeB, arrA, arrB):
	arrA.sort()
	prevValue = None
	indexSmaller = 0
	for x in arrB:
		indexSmaller = binarySearch(x, 0, sizeA - 1, arrA)
		if arrA[indexSmaller] > x:
			print(indexSmaller, end=' ')
		else:
			print(indexSmaller + 1, end=' ')
(sA, sB) = list(map(int, input().split()))
arrA = list(map(int, input().split()))
arrB = list(map(int, input().split()))
solve(sA, sB, arrA, arrB)


def binary(arr, s, n, ele):
	pos = 0
	start = s
	end = n - 1
	if ele < arr[0]:
		return 0
	while start <= end:
		mid = (start + end) // 2
		if arr[mid] <= ele:
			start = mid + 1
		elif arr[mid] > ele:
			pos = mid
			end = mid - 1
	if pos == 0:
		return n
	return pos
(n, m) = map(int, input().split())
ans = []
arr = list(map(int, input().split()))
brr = list(map(int, input().split()))
arr.sort()
for i in brr:
	ans.append(binary(arr, 0, n, i))
for i in ans:
	print(i, end=' ')


def value(arr, val):
	left = 0
	right = len(arr) - 1
	ans = -1
	while left <= right:
		mid = left + (right - left) // 2
		if arr[mid] <= val:
			ans = mid
			left = mid + 1
		else:
			right = mid - 1
	return ans + 1

def find(first, second):
	first.sort()
	ans = []
	for i in second:
		ans.append(str(value(first, i)))
	print(' '.join(ans))

def main():
	(f, s) = map(int, input().split())
	first = list(map(int, input().split()))
	second = list(map(int, input().split()))
	find(first, second)
main()


import bisect
(_, _) = input().split()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
for elem in b:
	print(bisect.bisect(a, elem), end=' ')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
b = [(int(x), i) for (x, i) in zip(input().split(), range(m))]
b.sort()
i = 0
cnt = 0
res = [0] * m
for j in range(m):
	while i < n and a[i] <= b[j][0]:
		cnt += 1
		i += 1
	res[b[j][1]] = cnt
print(*res)


from sys import stdin, stdout
(n, m) = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
b = [int(x) for x in stdin.readline().rstrip().split()]
a = sorted(a)
bidx = [x[0] for x in sorted(enumerate(b), key=lambda z: z[1])]
i = 0
for idx in bidx:
	v = b[idx]
	while i < len(a) and a[i] <= v:
		i += 1
	b[idx] = i
print(' '.join((str(x) for x in b)))


def less_or_equal(a, b):
	dict = {}
	sorted_b = sorted(b)
	sorted_a = sorted(a)
	i = 0
	for j in range(len(sorted_b)):
		while i < len(sorted_a) and sorted_a[i] <= sorted_b[j]:
			i += 1
		dict[sorted_b[j]] = i
	for x in b:
		print(dict[x], end=' ')
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
less_or_equal(a, b)


import bisect
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
b = list(map(int, input().split()))
out = []
for val in b:
	numLess = bisect.bisect(a, val)
	out.append(str(numLess))
print(' '.join(out))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = [[int(x), 0] for x in input().split()]
for i in range(m):
	b[i][1] = i
a.sort()
ans = [0] * m
max = a[-1]
b.sort()
start = 0
for i in range(m):
	count = start
	while start < n and a[start] <= b[i][0]:
		count += 1
		start += 1
	ans[b[i][1]] = count
print(*ans)


def main():
	(n, m) = map(int, input().split())
	(a, b) = ([], [])
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	a.sort()
	for val in b:
		(lo, hi, ans) = (0, n - 1, 0)
		while lo <= hi:
			mid = (lo + hi) // 2
			if a[mid] <= val:
				ans = mid + 1
				lo = mid + 1
			else:
				hi = mid - 1
		print(ans, end=' ')
main()


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from math import sqrt, floor, factorial, gcd, log
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
from math import gcd
from bisect import bisect
input = lambda : sys.stdin.readline().rstrip('\r\n')
read = lambda : list(map(int, input().strip().split(' ')))

def solve():
	(n, m) = read()
	a = read()
	b = read()
	a.sort()
	for i in b:
		ans = 0
		print(bisect(a, i), end=' ')
solve()


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
for i in range(m):
	c.append((b[i], i))
c.sort()
a.sort()
res = [0 for _ in range(m)]
p = 0
for i in range(m):
	while p < n and a[p] <= c[i][0]:
		p += 1
	res[c[i][1]] = p
for i in range(m):
	print(res[i], end=' ')


from bisect import bisect_right
import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def main():
	(n, m) = map(int, input().split())
	arr = sorted(list(map(int, input().split())))
	queries = list(map(int, input().split()))
	for v in queries:
		print(bisect_right(arr, v))
main()


def last(arr, low, high, x, n):
	while high >= low:
		mid = low + (high - low) // 2
		if (mid == n - 1 or x < arr[mid + 1]) and arr[mid] == x:
			return mid
		elif x < arr[mid]:
			high = mid - 1
		else:
			low = mid + 1
	return low

def find_val(arr, length, val):
	l = 0
	r = length - 1
	while r - 1 > l:
		mid = (l + r) // 2
		if val == arr[mid]:
			l = mid
			break
		elif val > arr[mid]:
			l = mid
		elif val < arr[mid]:
			r = mid
	if arr[r] == val:
		return r
	return l
(n, m) = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
A.sort()
l = []
for b_val in B:
	if b_val < A[0]:
		l.append('0')
		continue
	if b_val > A[-1]:
		l.append(str(n))
		continue
	ind = find_val(A, n, b_val)
	if A[ind] == b_val:
		ind = last(A, 0, n - 1, b_val, n)
	l.append(str(ind + 1))
print(' '.join(l))


input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()

def bsearch(l, n, lr=False):
	if len(l) == 0:
		return 0
	lw = 0
	hg = len(l) - 1
	while lw <= hg:
		va = l[int(lw / 2 + hg / 2)]
		if va <= i:
			lw = int(lw / 2 + hg / 2) + 1
		elif va > i:
			hg = int(lw / 2 + hg / 2) - 1
	return hg + 1
l = []
for i in b:
	c = bsearch(a, i)
	l += [str(c)]
print(' '.join(l))


import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(n, m) = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
d = {i: 0 for i in b}
for i in d:
	l = 0
	h = n
	f = 0
	while l < h:
		mid = (l + h) // 2
		if a[mid] == i:
			while mid < n and a[mid] == i:
				mid += 1
			d[i] = mid
			f = 1
			break
		elif a[mid] < i:
			l = mid + 1
		else:
			h = mid
	if f == 0:
		d[i] = l
print(*[d[i] for i in b])


import bisect

class Count:

	def __init__(self, x, c=1):
		self.x = x
		self.c = c

	def __eq__(self, other):
		return self.x == other.x

	def __lt__(self, other):
		return self.x < other.x

	def __repr__(self):
		return '({},{})'.format(self.x, self.c)

	def __str__(self):
		return self.__repr__()

def main():
	(num_xs, num_ys) = tuple(map(int, input().split()))
	xs = list(map(int, input().split()))
	ys = tuple(map(int, input().split()))
	xs.sort()
	counts = [Count(xs[0])]
	for x in xs[1:]:
		if x == counts[-1].x:
			counts[-1].c += 1
		else:
			counts.append(Count(x, counts[-1].c + 1))
	answers = list()
	for y in ys:
		j = bisect.bisect(counts, Count(y))
		if not j:
			answers.append(0)
		else:
			answers.append(counts[j - 1].c)
	print(' '.join(map(str, answers)))
main()


from bisect import bisect_right
(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
a.sort()
ans = []
for i in b:
	pos = bisect_right(a, i)
	ans.append(pos)
print(*ans)


import logging
import copy
import sys
import bisect
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)

def solve(secondLine, thirdLine):
	uniqList = list(set(thirdLine))
	countList = [0] * (len(uniqList) + 1)
	uniqList.sort()
	for a in secondLine:
		idx = bisect.bisect_left(uniqList, a)
		countList[idx] = countList[idx] + 1
	sums = [0] * (len(uniqList) + 1)
	sums[0] = countList[0]
	for i in range(1, len(sums)):
		sums[i] = sums[i - 1] + countList[i]
	log(sums)
	output = ''
	for a in thirdLine:
		idx = bisect.bisect_left(uniqList, a)
		output += str(sums[idx])
		output += ' '
	print(output[:-1])

def main():
	input()
	secondLine = list(map(int, input().split()))
	thirdLine = list(map(int, input().split()))
	solve(secondLine, thirdLine)

def log(*message):
	logging.debug(message)
main()


(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a.sort()
bb = sorted(b)
map = {}
i = j = 0
while j < len(bb):
	while i < len(a) and bb[j] >= a[i]:
		i += 1
	map[bb[j]] = i
	j += 1
print(' '.join((str(map[x]) for x in b)))


from bisect import bisect
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
answers = {}
a.sort()
for e in b:
	if not e in answers:
		answers[e] = bisect(a, e)
	print(answers[e], end=' ')


from bisect import bisect_right as ub
input()
a = list(sorted(map(int, input().split())))
for b in map(int, input().split()):
	print(ub(a, b), end=' ')
print()


(na, nb) = map(int, input().split())
a = list(map(int, input().split()))
b = [(int(x), i) for (x, i) in zip(input().split(), range(nb))]
a.sort()
b.sort()
a.append(10 ** 9 + 7)
j = 0
res = [0] * nb
for i in range(nb):
	while a[j] <= b[i][0]:
		j += 1
	res[b[i][1]] = j
print(*res)


(m, n) = input().rstrip().split(' ')
m = int(m)
n = int(n)
a = list(map(int, input().rstrip().split(' ')))
b = list(map(int, input().rstrip().split(' ')))
a = sorted(a)
bdic = {}
for it in range(n):
	bdic[it] = b[it]
b = sorted(b)
count = 0
flag = 0
countdic = {}
for i in range(n):
	while a[count] <= b[i]:
		count += 1
		if count == m:
			flag = -1
			break
	if flag == -1:
		break
	countdic[b[i]] = count
if flag == -1:
	for j in range(i, n):
		countdic[b[j]] = count
for (index, val) in bdic.items():
	print(countdic[val], end=' ')


def bin_search(n, length, sorted_list):
	(lo, hi) = (0, length - 1)
	while lo < hi:
		mid = (lo + hi) // 2
		cur_num = sorted_list[mid]
		if cur_num <= n:
			lo = mid + 1
		else:
			hi = mid
	if n < sorted_list[hi]:
		hi -= 1
	return hi + 1

def solve():
	(n, m) = map(int, input().split())
	a = sorted([int(x) for x in input().split()])
	b = [int(x) for x in input().split()]
	answers = []
	for number in b:
		answers.append(bin_search(number, n, a))
	print(*answers)
	return
solve()


from bisect import bisect_left, bisect_right
(N, M) = map(int, input().split())
A = sorted(map(int, input().split()))
B = list(map(int, input().split()))
res = []
for i in range(M):
	res.append(bisect_right(A, B[i]))
print(*res)


import bisect as bt
from sys import stdin, stdout

def main():
	outputs = []
	(n, m) = map(int, stdin.readline().strip().split())
	A = sorted([int(num) for num in stdin.readline().strip().split()])
	B = [int(num) for num in stdin.readline().strip().split()]
	for element in B:
		outputs.append(bt.bisect(A, element))
	for output in outputs:
		stdout.write(str(output) + '\n')
main()


import bisect
(n, m) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l1.sort()
r = []
for x in l2:
	r.append(str(bisect.bisect(l1, x)))
print(' '.join(r))


import bisect
entrada = input().split()
(lenA, lenB) = (int(entrada[0]), int(entrada[1]))
a = [int(i) for i in input().split()]
a.sort()
b = [int(i) for i in input().split()]
c = []
print(bisect.bisect_right(a, b[0]), end='')
for i in range(1, lenB):
	print('', bisect.bisect_right(a, b[i]), end='')
print()


import bisect
n = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
nums = []
for i in b:
	nums.append(str(bisect.bisect(a, i)))
print(' '.join(nums))


(n, m) = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
sa = sorted(a)
sb = sorted(b)
i = 0
j = 0
count = 0
dic = {}
while i < len(a) and j < len(b):
	if sa[i] > sb[j]:
		dic[str(sb[j])] = count
		j += 1
	elif sa[i] < sb[j]:
		count += 1
		i += 1
	elif sa[i] == sb[j]:
		count += 1
		i += 1
while j < len(sb):
	dic[str(sb[j])] = count
	j += 1
for x in b:
	print(dic[str(x)], end=' ')


from bisect import bisect_right
(n, m) = input().split(' ')
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
result = []
a = sorted(a)
for e in b:
	count = bisect_right(a, e)
	if count > 0:
		result += [str(count)]
	else:
		result += ['0']
print(' '.join(result))