George decided to prepare a Codesecrof round, so he has prepared m problems for the round. Let's number the problems with integers 1 through m. George estimates the i-th problem's complexity by integer b_{i}.

To make the round good, he needs to put at least n problems there. Besides, he needs to have at least one problem with complexity exactly a_1, at least one with complexity exactly a_2, ..., and at least one with complexity exactly a_{n}. Of course, the round can also have problems with other complexities.

George has a poor imagination. It's easier for him to make some already prepared problem simpler than to come up with a new one and prepare it. George is magnificent at simplifying problems. He can simplify any already prepared problem with complexity c to any positive integer complexity d (c ≥ d), by changing limits on the input data.

However, nothing is so simple. George understood that even if he simplifies some problems, he can run out of problems for a good round. That's why he decided to find out the minimum number of problems he needs to come up with in addition to the m he's prepared in order to make a good round. Note that George can come up with a new problem of any complexity.


-----Input-----

The first line contains two integers n and m (1 ≤ n, m ≤ 3000) — the minimal number of problems in a good round and the number of problems George's prepared. The second line contains space-separated integers a_1, a_2, ..., a_{n} (1 ≤ a_1 < a_2 < ... < a_{n} ≤ 10^6) — the requirements for the complexity of the problems in a good round. The third line contains space-separated integers b_1, b_2, ..., b_{m} (1 ≤ b_1 ≤ b_2... ≤ b_{m} ≤ 10^6) — the complexities of the problems prepared by George. 


-----Output-----

Print a single integer — the answer to the problem.


-----Examples-----
Input
3 5
1 2 3
1 2 2 3 3

Output
0

Input
3 5
1 2 3
1 1 1 1 1

Output
2

Input
3 1
2 3 4
1

Output
3



-----Note-----

In the first sample the set of the prepared problems meets the requirements for a good round.

In the second sample, it is enough to come up with and prepare two problems with complexities 2 and 3 to get a good round.

In the third sample it is very easy to get a good round if come up with and prepare extra problems with complexities: 2, 3, 4.

Source: codeforces | Difficulty: EASY
Tags: Complete search

Amortized analysis

Greedy algorithms


Solutions:
def inp():
	return map(int, input().split())
(n, m) = inp()
a = list(inp())
b = list(inp())
(i, j) = (0, 0)
while (i < n) & (j < m):
	if b[j] >= a[i]:
		i += 1
	j += 1
print(n - i)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
i = j = 0
while i < n and j < m:
	if b[j] >= a[i]:
		i += 1
	j += 1
print(n - i)


(n, m) = map(int, input().split())
good = [int(i) for i in input().split()]
prepared = [int(i) for i in input().split()]
i = j = res = 0
while i < n and j < m:
	if good[i] <= prepared[j]:
		i += 1
		j += 1
	else:
		j += 1
print(n - i)


R = lambda : list(map(int, input().split()))
(n, m) = R()
a = R()
b = R()
r = 0
for x in a:
	c = 0
	for y in b:
		if y >= x:
			c = 1
			b.pop(b.index(y))
			break
	if c == 0:
		r += 1
print(r)


import bisect

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

def nextl():
	return list(map(int, input().split()))
(n, m) = nexti()
a = sorted(nextl())
b = sorted(nextl())
count = 0
i = 0
j = 0
n = len(a)
while i < n:
	bis = bisect.bisect_left(b, a[i])
	if bis != len(b):
		count += 1
		del b[bis]
	i += 1
print(n - count)


(n, m) = map(int, input().split())
z = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 0
z.sort()
x.sort()
c1 = 0
c2 = 0
while c1 < n and c2 < m:
	if z[c1] <= x[c2]:
		c1 += 1
		c2 += 1
		ans += 1
	else:
		c2 += 1
print(n - ans)


(num_good, num_current) = map(int, input().split())
good = list(map(int, input().split()))
current = list(map(int, input().split()))
result = 0
pos_current = 0
pos_good = 0
while pos_good < num_good:
	x = good[pos_good]
	while pos_current < num_current and current[pos_current] < x:
		pos_current += 1
	if pos_current == num_current:
		break
	pos_current += 1
	pos_good += 1
print(num_good - pos_good)


rd = lambda : list(map(int, input().split()))
(n, m) = rd()
a = rd()
b = rd()
i = 0
f = 0
for e in a:
	while i <= m - 1:
		if b[i] >= e:
			f += 1
			i += 1
			break
		i += 1
print(n - f)


(n, m) = map(int, input().split(' '))
req = list(map(int, input().split()))
ava = list(map(int, input().split()))
count = 0
i = 0
j = 0
while i < n and j < m:
	if req[i] <= ava[j]:
		count += 1
		i = i + 1
	j += 1
print(n - count)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort()
j = -1
cnt = 0
for v in a:
	j += 1
	while j < m and v > b[j]:
		j += 1
	if j >= m:
		cnt += 1
print(cnt)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
li = list(map(int, input().split()))
l.sort()
li.sort()
i = 0
co = 0
while i < n:
	for j in range(len(li)):
		if li[j] >= l[i]:
			li.pop(j)
			co += 1
			break
	i += 1
print(n - co)


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

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

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7
(n, m) = rinput()
a = get_list()
b = get_list()
i = j = 0
while i < n and j < m:
	if a[i] <= b[j]:
		i += 1
	j += 1
print(n - i)


def solve_George_and_Round(n, m, A, B):
	i = j = 0
	while i < n:
		if A[i] <= B[j]:
			i += 1
		j += 1
		if j == m:
			break
	return len(A) - i
(n, m) = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
print(solve_George_and_Round(n, m, A, B))


first_line = input().split()
n = int(first_line[0])
m = int(first_line[1])
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
sum = n
p_a = n - 1
p_b = m - 1
while p_a >= 0 and p_b >= 0:
	if b[p_b] >= a[p_a]:
		sum -= 1
		p_a -= 1
		p_b -= 1
	else:
		p_a -= 1
print(sum)


def main():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = list()
	for x in a:
		if x in b:
			b.pop(b.index(x))
		else:
			c.append(x)
	L = 0
	if len(c) == 0:
		return 0
	i = 0
	while len(c):
		while i < len(b) and b[i] < c[0]:
			i += 1
		if i == len(b):
			return len(c)
		b.pop(i)
		c.pop(0)
	return len(c)
print(main())


(n, m) = map(int, input().split())
req = list(map(int, input().split()))
prep = list(map(int, input().split()))
i = 0
j = 0
while i < n and j < m:
	if req[i] <= prep[j]:
		i = i + 1
		j = j + 1
	else:
		j = j + 1
print(n - i)


nm = list(map(int, input().strip().split()))
a = list(map(int, input().strip().split()))
b = list(map(int, input().strip().split()))
a.sort()
b.sort()
(ca, cb) = (0, 0)
while ca < nm[0] and cb < nm[1]:
	if a[ca] <= b[cb]:
		ca += 1
	cb += 1
print(nm[0] - ca)


def GeorgeandRound():
	par1 = list(map(int, input().split()))
	par2 = list(map(int, input().split()))
	par3 = list(map(int, input().split()))
	n = par1[0]
	m = par1[1]
	j = 0
	count = 0
	for i in range(n):
		while j < m:
			if par2[i] == par3[j] or par3[j] > par2[i]:
				count = count + 1
				j = j + 1
				break
			j = j + 1
	return len(par2) - count
print(GeorgeandRound())


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
j = 0
count = 0
for i in range(n):
	while j < m:
		if a[i] == b[j] or b[j] > a[i]:
			count += 1
			j += 1
			break
		j += 1
print(str(n - count))


from collections import Counter
(n, m) = [int(i) for i in input().split()]
a = Counter([int(i) for i in input().split()])
b = Counter([int(i) for i in input().split()])
aa = list((a - b).elements())
bb = list((b - a).elements())
cnt = sum(a.values()) - len(aa)
aa.sort()
bb.sort()
i = 0
j = 0
while i < len(aa):
	while j < len(bb) and bb[j] < aa[i]:
		j += 1
	if j < len(bb) and bb[j] > aa[i]:
		cnt += 1
		j += 1
	i += 1
print(n - cnt)


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from operator import add
inf = float('inf')
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
(n, k) = r()
arr = rr()
brr = rr()
arr = arr[::-1]
brr = brr[::-1]
i = j = c = 0
while i < n and j < k:
	if brr[j] >= arr[i]:
		i += 1
		j += 1
	else:
		c += 1
		i += 1
print(c + n - i)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
i = 0
j = 0
count = 0
while i < n:
	while j < m:
		if b[j] == a[i] or b[j] > a[i]:
			count += 1
			j += 1
			break
		j += 1
	i += 1
print(n - count)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
j = 0
for i in range(n):
	while j < m and a[i] > b[j]:
		j += 1
	if j == m:
		print(n - i)
		exit()
	j += 1
print(0)


def main():
	(n, m) = map(int, input().split())
	aa = list(map(int, input().split()))
	it = iter(list(map(int, input().split())))
	try:
		for (i, a) in enumerate(aa, 1):
			b = next(it)
			while b < a:
				b = next(it)
	except StopIteration:
		i -= 1
	print(n - i)

def __starting_point():
	main()
__starting_point()


(n, m) = map(int, input().split())
must = list(map(int, input().split()))
have = list(map(int, input().split()))
mi = hi = 0
while mi < n and hi < m:
	if must[mi] > have[hi]:
		hi += 1
	else:
		mi += 1
		hi += 1
print(n - mi)


(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.sort()
i = 0
j = 0
while j < m and i < n:
	if b[j] < a[i]:
		j += 1
	else:
		i += 1
		j += 1
print(n - i)


(n, m) = map(int, input().split())
dif = list(map(int, input().split()))
x = list(map(int, input().split()))
while len(x) != 0 and len(dif) != 0:
	if x[0] >= dif[0]:
		del x[0]
		del dif[0]
	else:
		del x[0]
print(len(dif))


I = lambda : list(map(int, input().split()))
(n, m) = I()
a = I()
b = I()
i = j = 0
while i < n and j < m:
	i += 1 * (a[i] <= b[j])
	j += 1
print(n - i)


(n, m) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
i = 0
j = 0
while i < n and j < m:
	if l1[i] <= l2[j]:
		i += 1
		j += 1
	else:
		j += 1
print(n - i)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ap = 0
bp = 0
ans = n
while ap < n and bp < m:
	if b[bp] >= a[ap]:
		ap += 1
		ans -= 1
	bp += 1
print(ans)


(n, m) = map(int, input().split())
good = list(map(int, input().split()))
prepared = list(map(int, input().split()))
i = 0
j = 0
count = 0
while i < n and j < m:
	if prepared[j] >= good[i]:
		i += 1
		j += 1
		count += 1
	else:
		j += 1
print(n - count)


(n, m) = map(int, input().split())
from bisect import bisect_right as br
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [0 for i in range(n)]
for i in b:
	j = br(a, i) - 1
	if j == -1:
		continue
	c[j] += 1
ans = 0
for i in range(n - 1, -1, -1):
	if c[i] > 0:
		c[i] -= 1
	else:
		ans += 1
	c[i - 1] += c[i]
print(ans)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = 0
j = 0
for i in range(n):
	while j < m:
		if a[i] <= b[j]:
			cnt += 1
			j += 1
			break
		else:
			j += 1
print(n - cnt)


import sys
from bisect import *
from math import floor, sqrt, ceil, factorial as F, gcd, pi
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict, deque
INT_MAX = sys.maxsize
INT_MIN = -sys.maxsize - 1
mod = 1000000007
ch = 'abcdefghijklmnopqrstuvwxyz'
lcm = lambda a, b: a * b // gcd(a, b)
setbit = lambda x: bin(x)[2:].count('1')
INT = lambda type: type(sys.stdin.readline()) if type in [int, float] else type(sys.stdin.readline()).replace('\n', '')
ARRAY = lambda type: list(map(type, sys.stdin.readline().split()))
NUMS = lambda type: map(type, sys.stdin.readline().split())

def solve():
	(n, m) = NUMS(int)
	a = ARRAY(int)
	b = ARRAY(int)
	while len(a) > 0 and len(b) > 0:
		if a[0] <= b[0]:
			a.pop(0)
		b.pop(0)
	print(len(a))
solve()


(n, m) = map(int, input().split())
georg = list(map(int, input().split()))
good = list(map(int, input().split()))
good.sort()
georg.sort()
candoc = 0
j = 0
for i in range(min(n, m)):
	while j < m and good[j] < georg[i]:
		j += 1
	if j >= m:
		break
	if good[j] >= georg[i]:
		candoc += 1
		j += 1
	if j >= m:
		break
print(n - candoc)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [0] * int(1000000.0 + 5)
count = n
pointer = 0
for i in range(n):
	if pointer > m:
		break
	for j in range(pointer, m):
		if a[i] <= b[j]:
			count -= 1
			pointer = j + 1
			break
	if count == 0:
		print('0')
		exit()
print(count)


first = input('').split()
n = int(first[0])
m = int(first[1])
a = list(map(int, input('').split()))
b = list(map(int, input('').split()))
i = 0
j = 0
count = 0
while i < len(a) or j < len(b):
	if i < len(a) and j < len(b):
		if a[i] <= b[j]:
			i += 1
			j += 1
			n -= 1
		elif a[i] > b[j]:
			j += 1
	elif i < len(a):
		count = n
		break
	elif j < len(b):
		count = n
		break
print(n)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count = n
pointer = 0
for i in range(n):
	if pointer > m:
		break
	found = False
	for j in range(pointer, m):
		if a[i] <= b[j]:
			count -= 1
			pointer = j + 1
			found = True
			break
	if found == False:
		break
	if count == 0:
		print('0')
		exit()
print(count)


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.sort()
B.sort()
(i, j) = (len(A) - 1, len(B) - 1)
res = 0
while i >= 0 and j >= 0:
	if A[i] > B[j]:
		res += 1
		i -= 1
	else:
		j -= 1
		i -= 1
res += i + 1
print(res)


__author__ = 'Rajan'
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
i = 0
j = 0
for it in range(n):
	while j < m and b[j] < a[it]:
		j += 1
	if j >= m:
		break
	i += 1
	j += 1
print(n - i)


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
count = 0
i = 0
if B[0] >= A[n - 1]:
	if n > m:
		print(n - m)
		exit()
for j in range(0, m):
	if B[j] >= A[i]:
		i += 1
	if i == n:
		print(0)
		exit()
print(n - i)


def mi():
	return map(int, input().split())
(n, m) = mi()
a = list(mi())
b = list(mi())
a.sort()
b.sort()
for i in range(n):
	for j in range(m):
		if a[i] == b[j]:
			a[i] = -1
			b[j] = -1
			break
for i in range(n):
	for j in range(m):
		if a[i] != -1 and b[j] != -1 and (b[j] > a[i]):
			a[i] = b[j] = -1
			break
ans = 0
for i in range(n):
	if a[i] != -1:
		ans += 1
print(ans)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
k = list(map(int, input().split()))
i = j = 0
while i < n and j < m:
	i += 1 * (l[i] <= k[j])
	j += 1
print(n - i)


b = []
for v in input().split():
	b.append(int(v))
n = b[0]
m = b[1]
b = []
for x in input().split():
	b.append(int(x))
c = []
for _ in input().split():
	c.append(int(_))
i = 0
i1 = 0
f = 0
while i <= n - 1 and i1 <= m - 1:
	if b[i] <= c[i1]:
		i += 1
	i1 += 1
print(n - i)


def inp():
	return map(int, input().split())
(n, m) = inp()
a = list(inp())
b = list(inp())
r = j = cnt = 0
while r <= n - 1:
	if a[r] <= b[j]:
		r += 1
		cnt += 1
	j += 1
	if j > m - 1:
		break
print(n - cnt)


(n, m) = map(int, input().split())
(a, b) = (list(map(int, input().split())), list(map(int, input().split())))
(i1, i2) = (0, 0)
while i1 < n and i2 < m:
	if a[i1] <= b[i2]:
		i1 += 1
	i2 += 1
print(n - i1)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(len(a)):
	if a[i] != -1:
		for j in range(len(b)):
			if b[j] >= a[i] and b[j] != -1:
				a[i] = -1
				b[j] = -1
				break
print(abs(a.count(-1) - len(a)))


(n, m) = map(int, input().split())
v1 = list(map(int, input().split()))
v2 = list(map(int, input().split()))
p1 = 0
p2 = 0
while p1 < n and p2 < m:
	if v1[p1] <= v2[p2]:
		p1 += 1
		p2 += 1
	else:
		p2 += 1
print(n - p1)


def solve(N, M, A, B):
	for i in range(N):
		A[i] = int(A[i])
	for i in range(M):
		B[i] = int(B[i])
	B.append(0)
	j = 0
	for i in range(M):
		if j == N:
			break
		elif A[j] <= B[i]:
			j += 1
	return N - j
num_input = input()
num_input = num_input.split(' ')
N = int(num_input[0])
M = int(num_input[1])
A = input()
A = A.split(' ')
B = input()
B = B.split(' ')
print(solve(N, M, A, B))


def main():
	from sys import stdin, stdout
	(n, m) = map(int, stdin.readline().split())
	a = tuple(map(int, stdin.readline().split()))
	b = tuple(map(int, stdin.readline().split()))
	i = 0
	j = 0
	while True:
		if i >= n or j >= m:
			break
		if b[j] >= a[i]:
			i += 1
			j += 1
		else:
			j += 1
	stdout.write(str(n - i))
main()


def main():
	(N, M) = map(int, input().split())
	arrA = list(map(int, input().split()))
	arrB = list(map(int, input().split()))
	numberOfPreparation = N
	iA = 0
	iB = 0
	while iA != N and iB != M:
		if arrB[iB] >= arrA[iA]:
			iA += 1
			numberOfPreparation -= 1
		iB += 1
	print(numberOfPreparation)
	return True
main()


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
indexA = 0
indexB = 0
while indexB < m:
	if indexA == n:
		break
	if a[indexA] <= b[indexB]:
		indexA += 1
		indexB += 1
	else:
		indexB += 1
print(n - indexA)


(n, m) = [int(x) for x in input().split()]
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = 0
for i in range(n):
	flag = 0
	for j in range(len(b)):
		if b[j] >= a[i]:
			b.remove(b[j])
			flag = 1
			break
	if flag == 1:
		l += 1
print(n - l)


(n, m) = map(int, input().split())
list1 = list(map(int, input().split()))
list2 = list(map(int, input().split()))
i = n - 1
j = m - 1
c = 0
for k in range(n):
	if j < 0:
		c += 1
	elif list2[j] >= list1[i]:
		j -= 1
		i -= 1
	else:
		i -= 1
		c += 1
if m >= n:
	print(c)
else:
	print(c)


(n, m) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
can = 0
p1 = 0
for x in a:
	while p1 < m and b[p1] < x:
		p1 += 1
	if p1 < m:
		can += 1
		p1 += 1
print(n - can)


def test(n, a, b):
	count = len(a)
	left = 0
	right = 0
	while left < len(a):
		left += 1
		while right < len(b):
			right += 1
			if b[right - 1] >= a[left - 1]:
				count -= 1
				break
	return count
n = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
print(test(n, a, b))


from collections import Counter
(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
i = 0
j = 0
while i < n:
	while j < m and i < n:
		if A[i] <= B[j]:
			i += 1
			ans += 1
		j += 1
	i += 1
print(max(n - ans, 0))


def inp():
	return map(int, input().split())
(n, m) = inp()
a = list(inp())
b = list(inp())
count = 0
j = 0
for i in range(n):
	while j < m:
		if b[j] >= a[i]:
			count += 1
			j += 1
			break
		else:
			j += 1
print(n - count)


I = lambda : map(int, input().split())
(n, _) = I()
A = [*I()]
i = 0
for b in I():
	if A[i] <= b:
		i += 1
	if i == n:
		break
print(n - i)


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
dic = {}
ans = 0
for i in range(m):
	if B[i] in dic:
		dic[B[i]] += 1
	else:
		dic[B[i]] = 1
for i in range(n):
	co = True
	for each in dic:
		if each >= A[i] and dic[each] > 0:
			dic[each] -= 1
			co = False
			break
	if co:
		ans = n - i
		break
print(ans)


from sys import stdin

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

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

def linput():
	return list(map(int, stdin.readline().split()))
(n, m) = minput()
a = linput()
b = linput()
a.sort()
b.sort()
i = j = 0
while i < n and j < m:
	if b[j] >= a[i]:
		i += 1
		j += 1
	else:
		j += 1
print(n - i)


from __future__ import division, print_function
import math
import os
import sys
from sys import stdin, stdout
from io import BytesIO, IOBase
from itertools import accumulate
from collections import deque
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))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def regularbracket(t):
	p = 0
	for i in t:
		if i == '(':
			p += 1
		else:
			p -= 1
		if p < 0:
			return False
	else:
		if p > 0:
			return False
		else:
			return True

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	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

def reverse1(string):
	pp = ''
	for i in string[::-1]:
		pp += i
	if pp == string:
		return True
	return False

def reverse2(list1):
	l = []
	for i in list1[::-1]:
		l.append(i)
	if l == list1:
		return True
	return False
import math

def mex(list1):
	p = max(list1) + 1
	for i in range(len(list1)):
		if list1[i] != i:
			p = i
			break
	return p

def main():
	(n, m) = map(int, input().split())
	np = list(map(int, input().split()))
	mp = list(map(int, input().split()))
	np = sorted(np)
	mp = sorted(mp)
	cnt = 0
	for i in np:
		if len(mp) == 0:
			cnt += 1
		elif i in mp:
			continue
		elif i > max(mp):
			cnt += 1
		elif i < max(mp):
			for j in mp:
				if j > i:
					mp.remove(j)
					break
	print(cnt)
main()


(n, m) = map(int, input().split())
treb = list(map(int, input().split()))
est = list(map(int, input().split()))
c = [0 for i in range(max(treb[-1], est[-1]) + 1)]
for i in range(n):
	c[treb[i] - 1] += 1
i = m - 1
e = n
q = treb[-1]
while i != -1:
	d = True
	for j in range(min(est[i] - 1, q), -1, -1):
		if c[j] > 0:
			q = j
			c[j] -= 1
			d = False
			e -= 1
			break
	if d:
		print(e)
		exit(0)
	i -= 1
print(e)


n = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
j = 0
count = 0
for temp in b:
	if j >= n[0]:
		break
	if temp >= a[j]:
		j += 1
		count += 1
print(n[0] - count)


from collections import defaultdict
(n, m) = list(map(int, input().split()))
arr = list(map(int, input().split()))
brr = list(map(int, input().split()))
arr.sort()
brr.sort()
(p, q) = (0, 0)
ans = n
while p < n and q < m:
	if brr[q] >= arr[p]:
		ans -= 1
		(p, q) = (p + 1, q + 1)
	else:
		q += 1
print(ans)


(n, m) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
i = 0
j = 0
count = 0
while i < n and j < m:
	while j < m:
		if a[i] <= b[j]:
			count += 1
			j += 1
			break
		else:
			j += 1
	i += 1
print(n - count)


(round_problem_length, george_prepare_length) = map(int, input().split())
arr_round_problem = list(map(int, input().split()))
arr_george_prepare = list(map(int, input().split()))
match = 0
(i, j) = (0, 0)
while i < round_problem_length:
	while j < george_prepare_length:
		if arr_george_prepare[j] >= arr_round_problem[i]:
			match += 1
			j = j + 1
			break
		j += 1
	i += 1
print(round_problem_length - match)


from sys import stdin, stdout
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, stdin.readline().split()))
for _ in range(1):
	(n, m) = lst()
	a = lst()
	b = lst()
	p = p1 = ans = 0
	while p < n and p1 < m:
		if a[p] <= b[p1]:
			p += 1
			p1 += 1
		else:
			p1 += 1
	print(n - p)


(n, m) = map(int, input().rstrip().split())
(n_array, m_array) = (list(map(int, input().rstrip().split())), list(map(int, input().rstrip().split())))
(a, b) = (0, 0)
while (a < n) & (b < m):
	if n_array[a] <= m_array[b]:
		a += 1
	b += 1
print(n - a)


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

def main():
	(n, m) = map(int, input().split())
	a = readline()
	b = readline()
	(i, j) = (0, 0)
	while i < n and j < m:
		if a[i] <= b[j]:
			i += 1
		j += 1
	print(n - i)
main()


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
li = list(map(int, input().split()))
b = n
if b > m:
	b = m
for i in range(b, -1, -1):
	done = 1
	for j in range(0, i):
		if l[j] > li[m - i + j]:
			done = 0
			break
	if done:
		print(n - i)
		break


(N, M) = map(int, input().split())
list_A = list(map(int, input().split()))
list_B = list(map(int, input().split()))
ans = N
i = 0
j = 0
while i < N and j < M:
	if list_A[i] <= list_B[j]:
		ans -= 1
		j += 1
		i += 1
	else:
		j += 1
print(ans)


import sys
inf = float('inf')
(mod, MOD) = (1000000007, 998244353)
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right

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

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

def input():
	return sys.stdin.readline().strip()
(n, m) = get_ints()
required = get_array()
has = get_array()
visited = [False] * m
ans = 0
for i in range(n):
	index = bisect_left(has, required[i])
	flag = 0
	for j in range(index, m):
		if not visited[j]:
			visited[j] = True
			flag = 1
			break
	if flag == 0:
		ans += 1
print(ans)


(n, m) = [x for x in map(int, input().strip().split(' '))]
req = list(map(int, input().strip().split(' ')))
prep = list(map(int, input().strip().split(' ')))
count = 0
j = 0
for i in range(0, n):
	while j < m:
		if req[i] == prep[j] or prep[j] > req[i]:
			count = count + 1
			j = j + 1
			break
		j = j + 1
print(n - count)


def repaire_problems(num_need_problems, num_rep_problems, need_problems, rep_problems):
	start = num_need_problems
	if num_need_problems > num_rep_problems:
		start = num_rep_problems
	for index_i in range(start, -1, -1):
		flag = True
		for index_j in range(index_i):
			if need_problems[index_j] > rep_problems[num_rep_problems - index_i + index_j]:
				flag = False
				break
		if flag:
			return num_need_problems - index_i
	return 0
(num_need_problems, num_rep_problems) = list(map(int, input().split()))
need_problems = list(map(int, input().split()))
rep_problems = list(map(int, input().split()))
result = repaire_problems(num_need_problems, num_rep_problems, need_problems, rep_problems)
print(result)


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
az = 0
bz = 0
cnt = 0
while az < n and bz < m:
	if A[az] <= B[bz]:
		cnt += 1
		az += 1
		bz += 1
	else:
		bz += 1
print(max(0, n - cnt))


(number_of_n, number_of_m) = list(map(int, input().split()))
numbers_n = list(map(int, input().split()))
numbers_m = list(map(int, input().split()))
index = 0
total_existed = 0
for i in range(number_of_n):
	count = 0
	while index < number_of_m:
		if numbers_n[i] <= numbers_m[index]:
			total_existed += 1
			index += 1
			break
		index += 1
print(number_of_n - total_existed)


a = input()
b = input()
c = input()
(min_prob, num_prob) = [int(i) for i in a.split()]
complexity_req = [int(i) for i in b.split()]
complexity = [int(i) for i in c.split()]
j = 0
count = 0
for i in range(min_prob):
	while j < num_prob and complexity[j] < complexity_req[i]:
		j += 1
	if j < num_prob and complexity[j] >= complexity_req[i]:
		j += 1
	else:
		count += 1
print(count)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort()
i = 0
j = 0
k = 0
while i < n and j < m:
	if a[i] <= b[j]:
		k += 1
		i += 1
		j += 1
		continue
	else:
		j += 1
print(n - k)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
needed_problem_index = 0
prepared_problem_index = 0
while True:
	while prepared_problem_index < m and b[prepared_problem_index] < a[needed_problem_index]:
		prepared_problem_index += 1
	if prepared_problem_index >= m:
		break
	prepared_problem_index += 1
	needed_problem_index += 1
	if prepared_problem_index >= m:
		break
	if needed_problem_index >= n:
		break
print(n - needed_problem_index)


def input_sort():
	return sorted([int(c) for c in input().split()])

def main():
	(n, m) = map(int, input().split())
	a = input_sort()
	b = input_sort()
	(i, j) = (0, 0)
	while i < n and j < m:
		if a[i] <= b[j]:
			i += 1
		j += 1
	print(n - i)
main()


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
jb = 0
cnt = 0
for ai in a:
	while jb < m and b[jb] < ai:
		jb += 1
	if jb == m:
		break
	cnt += 1
	jb += 1
print(len(a) - cnt)


l1 = [int(x) for x in input().split()]
n = l1[0]
m = l1[1]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
i = 0
j = 0
a.sort()
b.sort()
while i < len(a) and j < len(b):
	if a[i] > b[j]:
		j += 1
	elif a[i] < b[j]:
		i += 1
	else:
		a.pop(i)
		b.pop(j)
i = 0
j = 0
while i < len(a) and j < len(b):
	if a[i] > b[j]:
		j += 1
	elif a[i] < b[j]:
		a.pop(i)
		b.pop(j)
print(len(a))


(n, m) = map(int, input().split())
a = input().split()
b = input().split()
for i in range(n):
	a[i] = int(a[i])
for i in range(m):
	b[i] = int(b[i])
a.sort(reverse=True)
b.sort()
answ = 0
v = {}
for i in range(m):
	if b[i] in v:
		v[b[i]] += 1
	else:
		v[b[i]] = 1
for i in range(n):
	if len(list(v.keys())) == 0:
		print(answ + n - i)
		exit()
	k = max(v.keys())
	if k < a[i]:
		answ += 1
	elif v[k] == 1:
		v.pop(k)
	else:
		v[k] -= 1
print(answ)


import os
import sys
from io import BytesIO, IOBase

def main():
	(n, m) = map(int, input().split(' '))
	a = list(map(int, input().split(' ')))
	b = list(map(int, input().split(' ')))
	c1 = 0
	c2 = 0
	while c1 < n and c2 < m:
		if a[c1] <= b[c2]:
			c1 += 1
			c2 += 1
		else:
			c2 += 1
	print(max(0, n - c1))
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()


strs = input().split(' ')
n = int(strs[0])
m = int(strs[1])
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
a.sort()
b.sort()
i = 0
j = 0
while i < len(a) and j < len(b):
	if a[i] <= b[j]:
		i += 1
		j += 1
	else:
		j += 1
res = len(a) - i
print(res)


L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
(n, m) = M()
a = L()
b = L()
(i, j) = (0, 0)
while i < n and j < m:
	if b[j] >= a[i]:
		i += 1
		j += 1
	else:
		j += 1
print(n - i)


datain = True
if datain:
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
else:
	(n, m) = (3, 5)
	a = [1, 2, 3]
	b = [1, 1, 1, 1, 1]
(ia, ib) = (0, 0)
while ia < n and ib < m:
	if a[ia] <= b[ib]:
		ia += 1
	ib += 1
print(n - ia)


(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
brr = list(map(int, input().split()))
arr.sort()
brr.sort()
j = 0
an = 0
for i in range(n):
	while j < m and arr[i] > brr[j]:
		j += 1
	if j < m and arr[i] <= brr[j]:
		j += 1
	else:
		an = n - i
		break
print(an)


(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
brr = list(map(int, input().split()))
countNumberProblemOfBArrayAlreadyInGoodRound = 0
j = 0
for i in range(m):
	if j < n and brr[i] >= arr[j]:
		countNumberProblemOfBArrayAlreadyInGoodRound += 1
		j += 1
print(n - countNumberProblemOfBArrayAlreadyInGoodRound)


def min_problems(good_round, problemas_preparados):
	contador = len(good_round)
	i = 0
	for _ in problemas_preparados:
		if contador == 0:
			return 0
		if _ < good_round[i]:
			continue
		else:
			contador -= 1
			i += 1
	return contador
(problemas_necesarios, num_problemas_preparados) = list(map(int, input().split()))
good_round = list(map(int, input().split()))
problemas_preparados = list(map(int, input().split()))
print(min_problems(good_round, problemas_preparados))


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = 0
d = 0
while c != len(a) and d != len(b):
	if a[c] <= b[d]:
		c = c + 1
	d = d + 1
print(len(a) - c)


(n, m) = map(int, input().split())
c = list(sorted(map(int, input().split())))
d = list(sorted(map(int, input().split())))
(i, j) = (0, 0)
while i < n and j < m:
	if c[i] <= d[j]:
		i += 1
	j += 1
print(n - i)


def check():
	(n, m) = [int(item) for item in input().split()]
	n_need = [int(item) for item in input().split()]
	m_have = [int(item) for item in input().split()]
	(i, j) = (0, 0)
	while i < n and j < m:
		if n_need[i] <= m_have[j]:
			i += 1
		j += 1
	print(n - i)
check()


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
b = list(map(int, input().split()))
b.sort()
l = -1
t = 0
for ax in a:
	l += 1
	while l < len(b) and ax > b[l]:
		l += 1
	if l < len(b) and ax <= b[l]:
		t += 1
print(len(a) - t)


a = input() + ' '
b = []
while ' ' in a:
	b.append(int(a[:a.index(' ')]))
	a = a[a.index(' ') + 1:]
comple_n = []
comple_m = []
c = input() + ' '
comple_n = []
while ' ' in c:
	comple_n.append(int(c[:c.index(' ')]))
	c = c[c.index(' ') + 1:]
d = input() + ' '
comple_m = []
while ' ' in d:
	comple_m.append(int(d[:d.index(' ')]))
	d = d[d.index(' ') + 1:]
while len(comple_n) != 0 and len(comple_m) != 0:
	if comple_n[0] <= comple_m[0]:
		comple_n.pop(0)
		comple_m.pop(0)
	else:
		comple_m.pop(0)
print(len(comple_n))


(n, m) = map(int, input().split())
aa = [int(s) for s in input().split()]
bb = [int(s) for s in input().split()]
ans = 0
aa.sort()
bb.sort()
l = 0
r = 0
kek = 0
for i in range(m):
	if l == n:
		break
	if bb[i] >= aa[l]:
		ans += 1
		l += 1
print(n - ans)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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 value():
	return map(int, input().split())

def array():
	return [int(i) for i in input().split()]
(n, m) = value()
a = set(array())
b = array()
d = Counter(b)
flag = defaultdict(bool)
for i in set(b):
	if i in a:
		d[i] -= 1
		flag[i] = True
b = list(set(b))
m = len(b)
ans = 0
for i in a:
	if not flag[i]:
		j = bisect_left(b, i)
		while j < m and d[b[j]] == 0:
			j += 1
		if j == m:
			ans += 1
		else:
			d[b[j]] -= 1
print(ans)


import re
temp = input()
temp = re.split(' ', temp)
n = eval(temp[0])
m = eval(temp[1])
temp = input()
temp = re.split(' ', temp)
a = []
for i in range(n):
	a.append(eval(temp[i]))
i = 0
temp = input()
temp = re.split(' ', temp)
for j in range(m):
	x = eval(temp[j])
	if i >= n:
		continue
	if x >= a[i]:
		i += 1
ans = n - i
print(ans)


(n, m) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a = sorted(a)
b = sorted(b)
j = 0
for i in range(len(b)):
	if j < n and b[i] >= a[j]:
		j += 1
if n - j < 0:
	print(0)
else:
	print(n - j)


(n, m) = tuple(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
while len(a) > 0 and len(b) > 0:
	if a[0] <= b[0]:
		a.pop(0)
	b.pop(0)
print(len(a))


(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()]
c = 0
k = 0
for i in range(len(a)):
	for j in range(c, len(b)):
		if a[i] <= b[j]:
			c = j + 1
			k += 1
			break
print(n - k)


(n, m) = map(int, input().split())
n_list = list(map(int, input().split()))
m_list = list(map(int, input().split()))
result = n
i = 0
j = 0
while i < n and j < m:
	if n_list[i] > m_list[j]:
		j += 1
	else:
		i += 1
		j += 1
		result = result - 1
print(result)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
j = 0
res = 0
for i in range(n):
	e = a[j]
	if e in b:
		a.pop(a.index(e))
		b.pop(b.index(e))
		j -= 1
	j += 1
i = 0
j = 0
if len(a):
	b = list(filter(lambda x: x >= min(a), b))
	if len(b):
		a.sort()
		b.sort()
		while i < len(a):
			j = 0
			while j < len(b):
				if b[j] >= a[i]:
					a.pop(i)
					b.pop(j)
					i -= 1
					break
				j += 1
			i += 1
print(len(a))


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
pa = 0
pb = 0
while pa < n and pb < m:
	if a[pa] <= b[pb]:
		pa += 1
		pb += 1
	else:
		pb += 1
print(n - pa)


def f():
	return [int(i) for i in input().split()]
([n, m], a, b) = (f(), f(), f())
for ai in a:
	for bi in b:
		if ai <= bi:
			n -= 1
			b.remove(bi)
			break
print(n if n > 0 else 0)


(n, m) = map(int, input().split())
ln = list(map(int, input().split()))
lm = list(map(int, input().split()))
i = j = 0
while i < n and j < m:
	if ln[i] <= lm[j]:
		i += 1
	j += 1
print(n - i)


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
j = 0
ans = 0
for i in range(n):
	a = A[i]
	while j < m:
		if A[i] <= B[j]:
			j += 1
			ans += 1
			break
		j += 1
print(n - ans)


(n, m) = map(int, input().split())
n_comp = [i for i in map(int, input().split())]
m_comp = [i for i in map(int, input().split())]
need = [True for i in range(n)]
i = 0
j = 0
while j < m and i < n:
	if n_comp[i] <= m_comp[j]:
		need[i] = False
		i += 1
		j += 1
	else:
		need[i] = True
		j += 1
print(sum(need))


import sys
import heapq
from math import *
from collections import defaultdict as dd
from collections import deque
from collections import Counter as c
from itertools import combinations as comb
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

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

def l():
	return list(map(int, data().split()))

def sl():
	return list(map(str, data().split()))

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 [[val for i in range(n)] for j in range(m)]
(n, m) = sp()
dpn = l()
dpm = l()
dpm.sort()
vis = [0 for i in range(n)]
for i in range(n):
	if dpn[i] in dpm:
		dpm.remove(dpn[i])
		vis[i] = 1
for i in range(n):
	if not vis[i]:
		temp = br(dpm, dpn[i])
		if temp != len(dpm):
			vis[i] = 1
			dpm.remove(dpm[temp])
answer = 0
for i in vis:
	if i == 0:
		answer += 1
out(str(answer))
exit()


(n, m) = map(int, input().split())
requirement = list(map(int, input().split()))
availability = list(map(int, input().split()))
count = 0
start = 0
stopFor = False
for i in range(0, n):
	for j in range(start, m):
		if requirement[i] <= availability[j]:
			start = j + 1
			break
		if j == m - 1:
			stopFor = True
			break
	if stopFor:
		count += n - i
		break
	if start >= m:
		count += n - i - 1
		break
print(count)


from sys import stdin, stdout
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
(n, m) = iia()
a1 = iia()
a2 = iia()
i = j = 0
while i < n and j < m:
	if a1[i] <= a2[j]:
		i += 1
	j += 1
print(n - i)


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = 0
cnt1 = 0
while cnt != len(a) and cnt1 != len(b):
	if a[cnt] <= b[cnt1]:
		cnt += 1
	cnt1 += 1
print(len(a) - cnt)


def sol(a, b, n, m):
	(i, j, exists) = (0, 0, 0)
	simplyfied = []
	psimplified = []
	while i < n and j < m:
		if a[i] == b[j]:
			exists += 1
			i += 1
			j += 1
		elif a[i] < b[j]:
			simplyfied.append(a[i])
			i += 1
		else:
			psimplified.append(b[j])
			j += 1
	while i < n:
		simplyfied.append(a[i])
		i += 1
	while j < m:
		psimplified.append(b[j])
		j += 1
	x = len(simplyfied)
	y = len(psimplified)
	xi = 0
	yi = 0
	while xi < x and yi < y:
		if simplyfied[xi] < psimplified[yi]:
			exists += 1
			xi += 1
			yi += 1
		else:
			yi += 1
	return n - exists
(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
print(sol(a, b, n, m))


def main():
	(minimum_problem, number_of_george_problems) = [int(i) for i in input().split()]
	require_problems = [int(i) for i in input().split()]
	george_problems = [int(i) for i in input().split()]
	count = 0
	check_point = 0
	for i in range(0, minimum_problem):
		for j in range(check_point, number_of_george_problems):
			if george_problems[j] >= require_problems[i]:
				count += 1
				check_point = j + 1
				break
	return minimum_problem - count
print(main())


(n, m) = map(int, input().split())
cono = list(map(int, input().split()))
geoo = list(map(int, input().split()))
(i, j) = (0, 0)
while i < n and j < m:
	if cono[i] <= geoo[j]:
		i += 1
	j += 1
print(n - i)


import bisect
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = 0
a = sorted(a)
b = sorted(b)
k = 0
l = 0
for i in range(len(a)):
	for j in range(k, len(b)):
		if b[j] >= a[i]:
			l += 1
			break
	k = j + 1
print(n - l)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort()
count = 0
p1 = 0
p2 = 0
while p1 < n and p2 < m:
	if a[p1] <= b[p2]:
		count += 1
		p1 += 1
	p2 += 1
print(n - count)


(n, m) = map(int, input().split())
a = [int(k) for k in input().split()]
b = [int(j) for j in input().split()]
f = 0
f1 = 0
while f < n and f1 < m:
	if b[f1] >= a[f]:
		f += 1
	f1 += 1
print(n - f)


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = a[::-1]
b = b[::-1]
(i, j) = (0, 0)
len_a = len(a)
len_b = len(b)
while i < len(a) and j < len(b):
	if a[i] <= b[j]:
		i += 1
		j += 1
		n -= 1
	else:
		i += 1
print(n)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
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
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

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)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass
(n, m) = L()
A = sorted(L())
B = sorted(L())
ans = 0
for i in range(n - 1, -1, -1):
	if A[-1] <= B[-1]:
		del A[-1]
		del B[-1]
	else:
		del A[-1]
		ans += 1
	if len(B) == 0:
		break
ans += len(A)
print(ans)
endtime = time.time()


(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()]
first = 0
second = 0
while first < n and second < m:
	if a[first] <= b[second]:
		first += 1
	second += 1
print(n - first)


def solve(a, b):
	i = j = res = 0
	while i < len(a) and j < len(b):
		if a[i] <= b[j]:
			i += 1
		j += 1
	res += len(a) - i
	return res
f = lambda : list(map(int, input().split()))
input()
res = solve(f(), f())
print(res)


import sys
import math
import heapq
import random
import collections
import bisect
import datetime

def main():
	n = list(map(int, input().strip().split()))
	l1 = list(map(int, input().strip().split()))
	l2 = list(map(int, input().strip().split()))
	count = 0
	for i in l1:
		pos = bisect.bisect_left(l2, i)
		if pos < len(l2) and l2[pos] >= i:
			l2 = l2[pos + 1:]
		else:
			count = count + 1
	print(count)
main()


(n, k) = map(int, input().split())
rounds = list(map(int, input().split()))
problems = list(map(int, input().split()))
i = 0
j = 0
count = n
while i < n and j < k:
	if rounds[i] <= problems[j]:
		count -= 1
		i += 1
		j += 1
	else:
		j += 1
print(count)


(number_of_n, number_of_m) = list(map(int, input().split()))
numbers_n = list(map(int, input().split()))
numbers_m = list(map(int, input().split()))
index = 0
total_existed = 0
i = 0
while i < number_of_n and index < number_of_m:
	if numbers_n[i] <= numbers_m[index]:
		total_existed += 1
		index += 1
		i += 1
	else:
		index += 1
print(number_of_n - total_existed)


A = input().split()
B = input().split()
C = input().split()
Barray = [int(x) for x in list(B)]
Carray = [int(x) for x in list(C)]
dem = 0
j = 0
for i in range(0, int(A[0])):
	while j < int(A[1]):
		if Barray[i] <= Carray[j]:
			dem += 1
			j += 1
			break
		j += 1
print(int(A[0]) - dem)


def main():
	nk = list(map(int, input('').split()))
	list1 = list(map(int, input('').split()))
	list2 = list(map(int, input('').split()))
	i = 0
	j = 0
	while i < len(list1) and j < len(list2):
		if list1[i] <= list2[j]:
			i += 1
			j += 1
		else:
			j += 1
	print(len(list1) - i)
main()


def read_input():
	(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(' ')]
	return (n, m, a, b)

def remain_prob_count(n, m, a, b):
	i = 0
	j = 0
	matched_count = 0
	while j < len(b) and i < len(a):
		if a[i] <= b[j]:
			matched_count += 1
			j += 1
			i += 1
		elif a[i] < b[j]:
			i += 1
		else:
			j += 1
	return n - matched_count

def main():
	(n, m, a, b) = read_input()
	print(remain_prob_count(n, m, a, b))
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()]
tmp = set()
j = 0
cnt = 0
for i in range(n):
	while j < len(b) and b[j] < a[i]:
		j += 1
	if j < len(b):
		cnt += 1
		j += 1
	else:
		break
print(n - cnt)


(n, m) = map(int, input().split())
dif = list(map(int, input().split()))
x = list(map(int, input().split()))
y = []
for i in range(m):
	if x[i] >= dif[0]:
		y.append(x[i])
while len(y) != 0 and len(dif) != 0:
	if y[0] >= dif[0]:
		del y[0]
		del dif[0]
	else:
		del y[0]
print(len(dif))


(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()]
ptr = 0
found = 0
for task in a:
	while ptr < m and b[ptr] < task:
		ptr += 1
	if ptr < m and b[ptr] >= task:
		found += 1
		ptr += 1
print(n - found)


(n, m) = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
y.sort()
x.sort()
i = 0
c = 0
for j in range(m):
	if i == n:
		break
	if y[j] >= x[i]:
		c += 1
		i += 1
print(n - i)


g = input()
(n, m) = [int(x) for x in g.split()]
liM = []
liN = []
for i in range(10 ** 6 + 1):
	liM.append(0)
t = input()
for x1 in t.split():
	liN.append(int(x1))
w = input()
for x2 in w.split():
	liM[int(x2)] += 1
	end1 = int(x2)
result = 0
coun = []
sumA = sum(liM[:end1 + 1])
for ki in range(1, liN[n - 1] + 1):
	coun.append(sumA - liM[ki - 1])
	sumA = sumA - liM[ki - 1]
result = 0
counter = 0
for i in range(n):
	gh = min(1, coun[liN[n - i - 1] - 1] - counter)
	counter += gh
print(n - counter)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count = n
pointer = 0
i = 0
j = 0
while (i < n) & (j < m):
	if b[j] >= a[i]:
		i += 1
		j += 1
	else:
		j += 1
print(n - i)


arr = [int(x) for x in input().split()]
(n, m) = (arr[0], arr[1])
li1 = [int(x) for x in input().split()]
li2 = [int(x) for x in input().split()]
li1.sort()
li2.sort()
(i, j) = (0, 0)
ans = 0
while i < n and j < m:
	if li1[i] == li2[j]:
		i += 1
		j += 1
	elif li1[i] < li2[j]:
		i += 1
		j += 1
	else:
		j += 1
if i == n:
	print(0)
else:
	print(n - i)


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
(n, m) = mi()
a = li()
b = li()
i = j = 0
while i < n and j < m:
	if a[i] <= b[j]:
		i += 1
	j += 1
print(n - i)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cout = 0
j = 0
for i in a:
	while j < m:
		if b[j] >= i:
			cout += 1
			j += 1
			break
		j += 1
print(n - cout)


(n, k) = list(map(int, input().split()))
l = list(map(int, input().split()))
l1 = list(map(int, input().split()))
i = 0
j = 0
while i < n and j < k:
	if l[i] <= l1[j]:
		i += 1
	j += 1
print(n - i)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
used = [False for _ in range(m)]
found = [False for _ in range(n)]
for i in range(n):
	for j in range(m):
		if a[i] == b[j] and (not used[j]):
			used[j] = True
			found[i] = True
			break
for i in range(n):
	if not found[i]:
		for j in range(m):
			if a[i] < b[j] and (not used[j]):
				used[j] = True
				found[i] = True
				break
count = 0
for i in range(n):
	if not found[i]:
		count += 1
print(count)


(n, m) = map(int, input().split())
a = [*map(int, input().split())]
b = [*map(int, input().split())]
a.sort()
b.sort()
i = j = ans = 0
while i < n:
	while j < m and a[i] > b[j]:
		j += 1
	if j == m:
		break
	i += 1
	j += 1
print(n - i)


first = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = first[0]
m = first[1]
posA = n - 1
posB = m - 1
count = 0
while posB > -1 and posA > -1:
	if b[posB] < a[posA]:
		count += 1
	else:
		posB -= 1
	posA -= 1
if posA != -1:
	count += posA + 1
print(count)


(n, m) = map(int, input().split())
good_round = list(map(int, input().split()))
george_prob = list(map(int, input().split()))
i = 0
j = 0
result = n
while i < n and j < m:
	if good_round[i] <= george_prob[j]:
		i += 1
		j += 1
		result -= 1
	else:
		j += 1
print(result)


import sys
import math
(n, m) = [int(x) for x in sys.stdin.readline().split()]
an = [int(x) for x in sys.stdin.readline().split()]
bm = [int(x) for x in sys.stdin.readline().split()]
i = 0
j = 0
res = n
while i < n:
	while j < m and an[i] > bm[j]:
		j += 1
	if j < m and an[i] <= bm[j]:
		res -= 1
		j += 1
	i += 1
print(res)


def solve(required, available, goodRound, prepared):
	pointer1 = 0
	pointer2 = 0
	while pointer1 < required and pointer2 < available:
		if goodRound[pointer1] <= prepared[pointer2]:
			pointer1 += 1
			pointer2 += 1
		else:
			pointer2 += 1
	return required - pointer1
(m, n) = list(map(int, input().split()))
k = list(map(int, input().split()))
s = list(map(int, input().split()))
print(solve(m, n, k, s))


def arr_inp():
	return [int(x) for x in stdin.readline().split()]
from sys import *
from collections import Counter
(n, m) = arr_inp()
(a, b) = [sorted(arr_inp()) for i in range(2)]
(c, ans) = (Counter(b), 0)
(p1, p2) = (0, 0)
while p1 < n and p2 < m:
	if a[p1] <= b[p2]:
		p1 += 1
		p2 += 1
	elif a[p1] > b[p2]:
		p2 += 1
print(n - p1)


def main():
	(n, k) = map(int, input().split())
	good = sorted(list(map(int, input().split())))
	prepared = sorted(list(map(int, input().split())))
	goodIdx = 0
	preparedIdx = 0
	while preparedIdx < k and goodIdx < n:
		if good[goodIdx] <= prepared[preparedIdx]:
			goodIdx += 1
			preparedIdx += 1
			continue
		preparedIdx += 1
	print(n - goodIdx)
main()


(n, m) = map(int, input().split())
nc = list(map(int, input().split()))
mc = list(map(int, input().split()))
i1 = 0
i2 = 0
while i1 < n and i2 < m:
	if nc[i1] <= mc[i2]:
		i1 += 1
	i2 += 1
print(n - i1)


first_line = list(map(int, input().split()))
n = first_line[0]
m = first_line[1]
a = list(map(int, input().split()))
b = list(map(int, input().split()))

def main():
	count = 0
	(i, j) = (0, 0)
	while i < n:
		while j < m:
			if a[i] <= b[j]:
				count += 1
				j += 1
				break
			else:
				j += 1
		i += 1
	print(n - count)
	return
main()


(n, m) = list(map(int, input().rstrip().split()))
a = list(map(int, input().rstrip().split()))
b = list(map(int, input().rstrip().split()))
li = [0] * n
k = 0
for i in range(m):
	for j in range(k, n):
		if li[j] == 0 and a[j] <= b[i]:
			li[j] = 1
			k = j
			break
count = 0
for i in li:
	if i == 0:
		count += 1
print(count)


(n, m) = map(int, input().split())
arrN = list(map(int, input().split()))
arrM = list(map(int, input().split()))
result = 0
if arrM[-1] < arrN[0]:
	result = n
else:
	j = m - 1
	pivot = arrM[j]
	for i in range(len(arrN) - 1, -1, -1):
		if j < 0:
			break
		if pivot >= arrN[i]:
			n -= 1
			j -= 1
			pivot = arrM[j]
	result = n
print(n)


(number_of_problems, number_of_prepared_problems) = map(int, input().split())
required_problems = list(map(int, input().split()))
prepared_problems = list(map(int, input().split()))
idx_required = idx_prepared = 0
while idx_required < number_of_problems and idx_prepared < number_of_prepared_problems:
	if prepared_problems[idx_prepared] >= required_problems[idx_required]:
		idx_required += 1
	idx_prepared += 1
result = number_of_problems - idx_required
print(result)


from sys import *
(n, m) = map(int, stdin.readline().split())
a = list(map(int, stdin.readline().split()))
b = list(map(int, stdin.readline().split()))
a.sort()
b.sort()
cnt = 0
for i in range(n):
	f = 0
	for j in range(m):
		if a[i] <= b[j]:
			b[j] = 0
			f = 1
			break
	if f == 0:
		cnt += 1
print(cnt)


def solv(array1, array2, n, m):
	j = 0
	for i in range(n):
		while j < m and array1[i] > array2[j]:
			j += 1
		if j == m:
			break
		if array1[i] <= array2[j]:
			j += 1
		i += 1
	print(n - i)
(n, m) = [int(x) for x in input().split()[0:2]]
array1 = input()
array1 = [int(x) for x in array1.split()]
array2 = input()
array2 = [int(x) for x in array2.split()]
solv(array1, array2, n, m)


import math
import sys
from collections import *
from bisect import bisect_left, bisect_right

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

def cstr():
	return list(map(str, input().split(' ')))

def solve():
	(n, k) = cint()
	lst1 = cint()
	lst2 = cint()
	lst1.sort(reverse=True)
	lst2.sort(reverse=True)
	i = 0
	j = 0
	counter = 0
	while i < n and j < k:
		if lst1[i] <= lst2[j]:
			i += 1
			j += 1
			counter += 1
		else:
			i += 1
	print(n - counter)
t = 1
while t != 0:
	solve()
	t -= 1


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
s = list(map(int, input().split()))
cou = j = i = 0
while j < m and i < n:
	if l[i] <= s[j]:
		cou += 1
		i += 1
		j += 1
	else:
		j += 1
print(n - cou)


import sys

def get_ints():
	return list(map(int, sys.stdin.readline().strip().split()))
temparr = get_ints()
req = get_ints()
qns = get_ints()
n = temparr[0]
k = temparr[1]
dicts = {}
qnsdicts = {}
for i in qns:
	if i not in qnsdicts:
		qnsdicts[i] = 1
	else:
		qnsdicts[i] += 1
for i in req:
	if i in qnsdicts:
		qnsdicts[i] -= 1
		if qnsdicts[i] == 0:
			del qnsdicts[i]
		continue
	if i not in dicts:
		dicts[i] = 1
	else:
		dicts[i] += 1
if len(dicts) == 0:
	print(0)
else:
	leftoverqns = []
	for (k, v) in qnsdicts.items():
		for i in range(v):
			leftoverqns.append(k)
	reqleftover = []
	for (k, v) in dicts.items():
		for i in range(v):
			reqleftover.append(k)
	arrn = sorted(reqleftover)
	arrm = sorted(leftoverqns)
	nn = len(reqleftover)
	mm = len(leftoverqns)
	indexn = 0
	indexm = 0
	solved = 0
	for i in range(nn):
		flag = 0
		curqns = arrn[i]
		for j in range(indexm, mm):
			indexm += 1
			gotqns = arrm[j]
			if gotqns > curqns:
				solved += 1
				flag = 1
				break
		if flag == 0:
			break
	print(nn - solved)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
jb = 0
count = 0
for ia in range(n):
	if jb == m:
		break
	while jb < m:
		if a[ia] == b[jb] or b[jb] > a[ia]:
			count = count + 1
			jb = jb + 1
			break
		jb = jb + 1
print(n - count)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort()
result = n
l = 0
r = m
for i in range(min(n, m)):
	if a[i] > b[-1] or b[-1] == 0:
		break
	elif a[i] <= b[-1]:
		for j in range(l, r):
			if a[i] <= b[j]:
				b[j] = 0
				result -= 1
				l = j + 1
				break
print(result)


ip = input()
n = int(ip.split()[0])
m = int(ip.split()[1])
n_list = list(map(int, input().split()))
m_list = list(map(int, input().split()))
count = 0
i = 0
for j in range(m):
	if n_list[i] <= m_list[j]:
		count += 1
		i += 1
	if i >= n:
		break
print(max(0, n - count))


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = [0] * len(A)
for i in range(len(A)):
	C[i] = A[i]
A.sort()
B.sort()

def search_index(x, A):
	l = -1
	r = len(A)
	while r - l > 1:
		m = int((l + r) / 2)
		if A[m] <= x:
			l = m
		else:
			r = m
	return l
i = len(A) - 1
j = len(B) - 1
k = len(A)
q = len(A)
for y in range(len(B) - 1, -1, -1):
	w = search_index(B[y], A[:q])
	q = w
	if w == -1:
		break
	else:
		k -= 1
print(k)


(n, m) = map(int, input().split())
res = list(map(int, input().split()))
spic = list(map(int, input().split()))
res.sort(reverse=True)
spic.sort(reverse=True)
nado = 0
for i in res:
	if m == 0:
		nado += 1
	elif spic[0] >= i:
		del spic[0]
		m -= 1
	else:
		nado += 1
print(nado)


import bisect
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count = 0
i = 0
while i < n:
	bis = bisect.bisect_left(b, a[i])
	if bis != len(b):
		count += 1
		del b[bis]
	else:
		break
	i += 1
print(n - count)


def george_and_round(a_problems, b_problems):
	count = 0
	pointer = len(b_problems) - 1
	for i in range(len(a_problems) - 1, -1, -1):
		problem = a_problems[i]
		if pointer < 0:
			return len(a_problems) - count
		if problem <= b_problems[pointer]:
			count += 1
			pointer -= 1
	return len(a_problems) - count
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print(george_and_round(a, b))


from sys import stdin
from string import ascii_uppercase
hat = stdin.readlines()
(n, m) = map(int, hat[0].split())
a = sorted([int(x) for x in hat[1].split()])
b = sorted([int(x) for x in hat[2].split()])
counter = 0
for i in range(len(a)):
	flag = False
	for j in range(len(b)):
		if b[j] >= a[i]:
			b.pop(j)
			flag = True
			break
	if not flag:
		counter += 1
print(counter)


(round_n, made_n) = map(int, input().split())
round = list(map(int, input().split()))
made = list(map(int, input().split()))
i = 0
j = 0
while i < round_n:
	while j < made_n:
		if made[j] >= round[i]:
			j += 1
			i += 1
			break
		j += 1
	if j == made_n:
		break
print(round_n - i)


def more_prepare(A, B):
	count = 0
	temp = len(A)
	for item_b in B:
		if count == temp:
			return 0
		for item_a in A:
			if item_b >= item_a:
				count += 1
				A.remove(item_a)
			break
	return temp - count
(n, m) = list(map(int, input().split()))
good_round_complexity = list(map(int, input().split()))
prepared_complexity = list(map(int, input().split()))
print(more_prepare(good_round_complexity, prepared_complexity))


from bisect import bisect_left

def binr(a, x, lo=0, hi=None):
	hi = hi if hi is not None else len(a)
	pos = bisect_left(a, x, lo, hi)
	if pos < hi:
		return pos
	else:
		return -1
(n, m) = map(int, input().split())
d = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
fl = True
ans = 0
for i in d:
	if i not in a:
		fl = False
if fl == True:
	print(0)
	return
for i in range(n):
	if d[i] in a:
		d[i] = 0
	r = binr(a, d[i])
	if r == -1:
		ans += 1
	else:
		a[r] = -1
	a.sort()
print(ans)


(n, m) = list(map(int, input().split()))
a = list(map(int, input().rstrip().split()))
a.sort()
b = list(map(int, input().rstrip().split()))
b.sort()
count = 0
for i in range(len(a)):
	flag = 0
	for j in range(len(b)):
		if b[j] == a[i]:
			flag = 1
			a[i] = -1
			b[j] = -1
			break
if a.count(-1) == len(a):
	print(0)
else:
	g = []
	for i in range(len(b)):
		if b[i] != -1:
			g.append(b[i])
	c = []
	for i in range(len(a)):
		if a[i] != -1:
			c.append(a[i])
	g.sort(reverse=True)
	c.sort(reverse=True)
	while len(c) > 0 and len(g) > 0:
		if g[0] >= c[0]:
			g.pop(0)
			c.pop(0)
		else:
			count += 1
			c.pop(0)
	print(count + len(c))


def main():
	nm = input().split(' ')
	s1 = input().split(' ')
	s2 = input().split(' ')
	n = int(nm[0])
	m = int(nm[1])
	j = 0
	for i in range(len(s1)):
		while j < m and int(s2[j]) < int(s1[i]):
			j += 1
		if j < m:
			n -= 1
			j += 1
		else:
			break
	print(n)
main()


def solve():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	al = len(a)
	bl = len(b)
	ai = 0
	bi = 0
	while ai < al and bi < bl:
		if a[ai] > b[bi]:
			bi += 1
		else:
			ai += 1
			bi += 1
	ans = al - ai
	print(ans)
solve()


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

def goodRound(An, Bm, n, m):
	count = 0
	Ia = Ib = 0
	while Ia < n and Ib < m:
		if An[Ia] <= Bm[Ib]:
			Ia += 1
			Ib += 1
		else:
			Ib += 1
	if Ia < n:
		count = n - Ia
	return count
print(goodRound(a, b, n, m))


a = input().split()
n = int(a[0])
m = int(a[1])
a = input().split()
b = input().split()
j = 0
for i in range(0, m):
	if j < n and int(a[j]) <= int(b[i]):
		j += 1
print(n - j)


from bisect import bisect_left as bl
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = 0
for i in a:
	j = bl(b, i)
	if j == m:
		cnt += 1
	elif b[j] >= i:
		b[j] = -1
		b.sort()
print(cnt)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
p = 0
for i in range(m):
	if a[p] <= b[i]:
		p += 1
	if p >= n:
		break
print(n - p)


firstLine = input().split()
n = int(firstLine[0])
m = int(firstLine[1])
good = list(map(int, input().split()))
probs = list(map(int, input().split()))

def check(good, probs):
	count = 0
	n = len(good)
	m = len(probs)
	j = 0
	while j < m and count < n:
		if probs[j] >= good[count]:
			count += 1
		j += 1
	return count

def george(n, m, good, probs):
	if n == len(good) and n == len(set(probs)):
		return 0
	return n - check(good, probs)
print(george(n, m, good, probs))


while True:
	try:

		def soln(r, h):
			i = j = 0
			while i < len(h):
				while j < len(r):
					if h[i] >= r[j]:
						j += 1
						break
					break
				i += 1
			if j == len(r):
				print('0')
			else:
				print(len(r) - j)

		def read():
			(n, m) = map(int, input().split())
			rq = list(map(int, input().split()))
			hs = list(map(int, input().split()))
			soln(rq, hs)
		if __name__ == '__main__':
			read()
	except EOFError:
		break


(n, m) = map(int, input().split())
arrA = list(map(int, input().split()))
arrB = list(map(int, input().split()))
k = n
pA = 0
pB = 0
while pB < m:
	if arrB[pB] >= arrA[pA]:
		k -= 1
		pA += 1
		if pA >= n:
			break
	pB += 1
print(k)


(n, m) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
c = {}
for i in b:
	if i in c:
		c[i] += 1
	else:
		c[i] = 1
d = {}
for i in a:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
p = n
for i in a:
	if i in c:
		if c[i] > 0:
			c[i] -= 1
			p -= 1
			d[i] -= 1
for i in a:
	for j in b:
		if j > i and c[j] > 0 and (d[i] > 0):
			c[j] -= 1
			p -= 1
			d[i] -= 1
			break
print(p)


(n, m) = map(int, input().split())
ls1 = list(map(int, input().split()))
ls2 = list(map(int, input().split()))
count = n
i = 0
j = 0
while i < n and j < m:
	if ls1[i] <= ls2[j]:
		i += 1
		j += 1
		count -= 1
	elif ls1[i] > ls2[j]:
		j += 1
print(count)


R = lambda : map(int, input().split())
(n, m) = R()
a = [*R()]
b = [*R()]
(i, j) = (0, 0)
while i < n and j < m:
	if b[j] >= a[i]:
		i += 1
	j += 1
print(n - i)


(n, m) = map(int, list(input().split()))
a = list(map(int, list(input().split())))
b = list(map(int, list(input().split())))
cnt = [0] * int(1000000.0 + 5)
count = 0
i = j = 0
while i < n and j < m:
	if b[j] < a[i]:
		j += 1
	else:
		i += 1
		j += 1
print(n - i)


(n, m) = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
total = 0
B.sort(reverse=True)
A.sort(reverse=True)
for i in range(n):
	if len(B):
		if B[0] >= A[i]:
			B.remove(B[0])
			continue
		else:
			total += 1
	else:
		total += 1
print(total)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = 0
r = 0
while l < n:
	while r < m and b[r] < a[l]:
		r += 1
	if r == m:
		break
	l += 1
	r += 1
print(n - l)


import sys
(n, m) = map(int, input().split())
a = tuple(map(int, input().split()))
b = tuple(map(int, input().split()))
(i, j, cnt) = (0, 0, 0)
while i < n and j < m:
	if a[i] <= b[j]:
		i += 1
		j += 1
	elif a[i] > b[j]:
		j += 1
print(n - i)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count = 0
for i in range(n):
	c = 0
	for j in range(m):
		if b[j] >= a[i]:
			c = 1
			b.remove(b[j])
			m = m - 1
			break
	if c == 0:
		count += 1
print(count)


vals = [int(x) for x in input().split()]
n = vals[0]
m = vals[1]
problemRound = [int(x) for x in input().split()]
problemSet = [int(x) for x in input().split()]
i = 0
j = 0
while i < n and j < m:
	if problemRound[i] <= problemSet[j]:
		i += 1
	j += 1
print(n - i)


(n, m) = map(int, input().strip().split())
p = list(map(int, input().split()))
b = list(map(int, input().split()))
start = 0
end = -1
answer = 0
for i in range(n):
	for j in range(start, m, 1):
		start = j + 1
		if b[j] >= p[i]:
			end = i
			break
	if i == n - 1 or start == m:
		answer = n - 1 - end
		break
print(answer)


ii = lambda : int(input())
kk = lambda : map(int, input().split())
ll = lambda : list(kk())
(n, m) = kk()
(ps, bs) = (ll(), ll())
b = c = 0
for a in range(n):
	while b < m and bs[b] < ps[a]:
		b += 1
	if b == m:
		c += 1
	else:
		b += 1
print(c)