#SGM0000021. Phân phòng khách sạn (Hotel Queries)

Phân phòng khách sạn (Hotel Queries)

Hotel Queries

Source: CSES

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn hotels numbered from 11 to nn. Hotel ii currently has hih_i free rooms. There are mm groups arriving in order, and group jj requires rjr_j rooms in one hotel.

For each group, choose the smallest hotel index whose number of free rooms is at least rjr_j. Then decrease that hotel's free-room count by rjr_j. If no hotel can accommodate the group, it is not assigned.

Input

The first line contains n,mn,m.

The second line contains h1,h2,…,hnh_1,h_2,\ldots,h_n.

The third line contains r1,r2,…,rmr_1,r_2,\ldots,r_m.

Output

Print mm integers. The jj-th integer is the selected hotel index, or 00 if the group cannot be assigned.

Subtasks

  • Subtask 1 — 20%: 1≤n,m≤501\le n,m\le 50.
  • Subtask 2 — 30%: 1≤n,m≤50001\le n,m\le 5000.
  • Subtask 3 — 50%: 1≤n,m≤2⋅1051\le n,m\le 2\cdot 10^5, 1≤hi,ri≤1091\le h_i,r_i\le 10^9.

Examples

Input

8 5
3 2 4 1 5 5 2 6
4 4 7 1 1

Output

3 5 0 1 1

Explanation

The sample is processed in order; every printed item/line corresponds to an operation that requires output.