# 2021 年东华大学金马程序设计联赛

D. Move the numbers
PDF 题面可用

John has learned data structure and algorithm course this semester, and he has a problem in the latest problemset that he desperately needs your help.

Given a permutation $a_1,a_2,\cdots,a_n$ of $1, 2,\cdots, n$, and the position of the elements will be adjusted $m$ times.

Each adjustment specifies a index $k$, which means to adjust the array with following operation:

• First, append all numbers before the $k$-th number to the end of the array in order.
• And then, delete all numbers before the $k$-th number.

Your task is to find the final permutation after $m$ operations.

### 输入格式

There are multiple test cases in this problem, and the input of each test case are as following statement:

In the first line of each test case, there are two integers $n$ and $m$ ($1\leq n,m\leq 10^5$) , representing the number of elements in the array and the adjustment times correspondingly.

In the second line of each test case, there is a permutation $a_1,a_2,\cdots,a_n$ of $1, 2,\cdots, n$, representing the original permutation.

And in the last line of each test case, there are $m$ integers, representing the index $k(1\leq k\leq n)$ of each adjustment.

It is guaranteed that the sum of $n$ over all test cases does not exceed $2\times 10^5$, and the sum of $m$ over all test cases also does not exceed $2\times 10^5$.

### 输出格式

For each test case, output one line which contains $n$ integers (separated by a space), representing the final permutation after $m$ operations.

### 样例

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

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


NaN