A Search Problem

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 1.0s
PyPy 3 2.0s
Memory limit: 64M

Author:
Problem type

Given N (1 \le N \le 2\times10^5) non-negative integers and Q (1 \le Q \le 2\times10^5) queries, for each query q_i, find the number of integers that compare strictly less than q_i.

Constraints

Subtask 1 [20%]

N, Q \le 1000

Subtask 2 [80%]

No additional constraints.

Input Specification

The first line will contain two integers, N and Q.

The second line will contain N space-separated integers N_i (0 \le N_i \le 10^5).

The next Q lines will each contain one integer q_i (0 \le q_i \le 10^5).

Output Specification

Output Q integers, each on a separate line, denoting the number of integers less than Q_i.

Sample Input

5 3
12 52 69 12 34
14
100
52

Sample Output

2
5
3

Comments

There are no comments at the moment.