Problem 03B. Rank Queries ≡

Author:Pavel Mesenev   Time limit:2 sec
Input file:Standard input   Memory limit:256 Mb
Output file:Standard output  

Statement

You are given an array of n integers a0, a1, …, an − 1 and q queries. Each query is an integer x; answer with the number of array elements that are strictly less than x.

Input format

The first line contains two integers n and q. The second line contains n integers a0… an − 1. The third line contains q integers — the queries.

Output format

Print q lines; line j is the answer to the j-th query.

Constraints

1 ≤ n ≤ 105

1 ≤ q ≤ 105

 − 109 ≤ ai ≤ 109,   − 109 ≤ x ≤ 109

Sample tests

No. Standard input Standard output
1
5 3
5 1 4 1 3
4 1 100
3
0
5
2
1 2
7
7 8
0
1
3
6 4
2 2 2 2 2 2
1 2 3 2
0
0
6
0

0.075s 0.028s 16