PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000101. Vị trí gần nhất bên trái (Closest to the Left)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Vị trí gần nhất bên trái (Closest to the Left)

Closest to the Left

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Given a non-decreasing array a1,…,ana_1,\ldots,a_n, for each query xx output the largest one-based index pp with ap≤xa_p\le x, or 00 if none exists.

Input

The first line contains n,qn,q. The second contains nn sorted integers. The third contains qq queried integers.

Output

Print qq one-based indices (or 00), in query order, separated by spaces.

Subtasks

  • Subtask 1 (20 points): 1≤n,q≤201\le n,q\le 20; −109≤ai≤109-10^9\le a_i\le10^9; −109≤xj≤109-10^9\le x_j\le10^9; array is non-decreasing.
  • Subtask 2 (30 points): 1≤n,q≤20001\le n,q\le 2000; −109≤ai≤109-10^9\le a_i\le10^9; −109≤xj≤109-10^9\le x_j\le10^9; array is non-decreasing.
  • Subtask 3 (50 points): 1≤n,q≤1000001\le n,q\le 100000; −109≤ai≤109-10^9\le a_i\le10^9; −109≤xj≤109-10^9\le x_j\le10^9; array is non-decreasing.

Examples

Input

5 5
1 3 3 4 10
3 2 11 0 4

Output

3 1 5 0 4

Explanation

For x=3x=3, entries 1,3,31,3,3 qualify, so the last index is 33. For 22 only entry 11 qualifies. All five entries qualify for 1111, none for 00, and the first four for 44. Thus the output is 3 1 5 0 4.