P8838 [ChuanZhi Cup #3 Finals] Interview.
Background
disangan233 and disangan333 went to an interview. The interviewer gave them a problem. Can you, as a helpful person, assist them?
Description
There are $n$ servers. Server $i$ can process data of size at most $a_i$.
Next, there will be $k$ commands $b_k$. Command $i$ means sending data of size $b_i$, and you need to assign an idle server to it.
Please compute a sequence $p_k$ indicating that the data of command $i$ is assigned to server $p_i$, and $p_k$ is lexicographically smallest. If it is impossible to assign, output "-1".
For all testdata, $n, k \leq 6$, $a_i, b_i \leq 10$.
Input Format
The input consists of $3$ lines.
Line $1$ contains two positive integers $n, k$.
Line $2$ contains $n$ positive integers $a_i$, where $a_i$ indicates the maximum data size that server $i$ can process.
Line $3$ contains $k$ positive integers $b_i$, where $b_i$ indicates command $i$.
Output Format
Output one line containing $k$ positive integers $p_1 \ldots p_k$, or output "-1".
Explanation/Hint
### Sample Explanation
Command $1$ is assigned to server $1$.
Command $2$ is assigned to server $3$.
Command $3$ is assigned to server $2$.
Command $4$ is assigned to server $4$.
Command $5$ is assigned to server $6$.
Command $6$ is assigned to server $5$.
Translated by ChatGPT 5