~/algor $ cat problems/ochkoz-shirinliklar
Handing out candies
Problem of the day
Easy
1000 ms
128 MB
29%
There are $n$ children and $m$ candies. The $i$-th child is happy only if they get a candy of size at least $g_{i}$; the size of the $j$-th candy is $c_{j}$. Each child gets at most one candy, and each candy goes to at most one child. Find the largest number of children that can be made happy.
Input
The first line contains two positive integers: $n$ and $m$. The second line contains $n$ positive integers $g_{1}, \dots, g_{n}$. The third line contains $m$ positive integers $c_{1}, \dots, c_{m}$.
Output
One integer — the largest number of happy children.
Note
$1 \le n, m \le 10^{5}$
$1 \le g_{i}, c_{j} \le 10^{9}$
Examples
Input #1
3 2 1 2 3 1 1
Output #1
1
Input #2
2 3 1 2 1 2 3
Output #2
2