5661: Number of Smaller
[Creator : ]
Description
You are given two arrays, sorted in non-decreasing order.
For each element of the second array, find the number of elements in the first array strictly less than it.
For each element of the second array, find the number of elements in the first array strictly less than it.
Input
The first line contains integers $n$ and $m$, the sizes of the arrays ($1≤n,\ m≤10^5$).
The second line contains $n$ integers $a_i$, elements of the first array.
The third line contains $m$ integers $b_i$, elements of the second array ($−10^9≤a_i,\ b_i≤10^9$).
The second line contains $n$ integers $a_i$, elements of the first array.
The third line contains $m$ integers $b_i$, elements of the second array ($−10^9≤a_i,\ b_i≤10^9$).
Output
Print $m$ numbers, the number of elements of the first array less than each of the elements of the second array.
Sample 1 Input
6 7
1 6 9 13 18 18
2 3 8 13 15 21 25
Sample 1 Output
1 1 2 3 4 6 6