|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|1 초 (추가 시간 없음)||1024 MB (추가 메모리 없음)||260||96||90||43.689%|
Yunee did not study for the final exam. So Yunee decided to guess the answers to all problems in the final exam. The final exam consists of $N$ single choice questions numbered from $1$ to $N$, each with a choice of $1$ to $5$.
Yunee gets anxious when the answers to two successive problems are the same. So Yunee always selects an answer different from the answer to the previous problem (except for the first problem). After submitting the answers, Yunee received the grading result, which stated whether each answer was correct.
Given the correct answers to all problems and the $M$ problems that Yunee guessed correctly, reconstruct a possible sequence of Yunee's answers. It is guaranteed that at least one such sequence exists for each input.
The first line contains two integers $N$ and $M$ $(1 \leq N \leq 100,000, 1\leq M \leq N)$. $N$ is the total number of problems. $M$ is the number of problems that Yunee guessed correctly.
The second line contains $N$ integers from $1$ to $5$. The $i$-th integer represents the correct answer to the $i$-th problem.
The third line contains $M$ distinct integers from $1$ to $N$. They represent the $M$ problems that Yunee guessed correctly.
Output a possible sequence of Yunee's answers. Each number should be separated by a blank.
4 2 1 1 2 3 1 4
1 5 4 3
In the first example, suppose Yunee submitted the answers $1, 5, 4, 3$. Since the correct answers are $1, 1, 2, 3$, Yunee correctly guessed problems $1$ and $4$.
3 2 1 2 3 1 3
1 4 3