#c22501. 二分查找

二分查找

Binary Search Counts

Problem Description

There are nn numbers a1,a2,…,ana_1, a_2, \dots, a_n and mm queries.

Each query gives a number xx; you must answer, among a1,a2,…,ana_1, a_2, \dots, a_n, how many numbers are less than xx, equal to xx, and greater than xx respectively.

Input Format

The first line contains two integers n,mn, m. The next line contains nn integers, the sequence a1,a2,…,ana_1, a_2, \dots, a_n.

The following mm lines each contain one integer xx.

Output Format

Output mm lines, each containing three integers: the answer.

Sample Input

6 6
3 5 1 5 3 5
1
2
3
4
5
6

Sample Output

0 1 5
1 0 5
1 2 3
3 0 3
3 3 0
6 0 0

Constraints

For 100%100\% of the data: 1≤n,m≤2×1051 \leq n, m \leq 2\times 10^5, 1≤ai,x≤1091 \leq a_i, x \leq 10^9.