#GYM104736K. Keen on Order
Keen on Order
Description
Nloglonia is hosting a movie festival that spans $N$ days. There are $K$ distinct movies, and on each of the $N$ days, one of them will be displayed. Each of the available movies might be displayed on multiple days or not displayed at all during the festival.
The festival schedule is given as an integer array $V$ of size $N$, with $1 \leq V_i \leq K$, indicating which movie will be shown on each day. Bob wants to watch all $K$ movies, and he firmly believes that the order in which he watches them will significantly affect his experience. So now he wonders: is it true that for every order of the movies, he would be able to pick $K$ days to visit the festival and watch those movies in that given order? More formally, is it true that every permutation of ${1}, {2}, \ldots, {K}$ is a subsequence of $V$? If this is not the case, Bob also wants you to find some permutation (any one) that is not.
The first line contains two integers $N$ and $K$ ($1 \leq N, K \leq 300$), indicating respectively the number of days the movie festival lasts and the number of movies available for display.
The second line contains $N$ integers ${V_1}, {V_2}, \ldots, {V_N}$ ($1 \leq V_i \leq K$ for ${i}={1}, {2}, \ldots, {N}$, indicating that the movie $V_i$ will be displayed on day $i$.
Output a single line with $K$ integers showing a permutation of ${1}, {2}, \ldots, {K}$ which is not a subsequence of $V$. If every permutation is a subsequence of $V$, output the character "*" (asterisk) instead.
Input
The first line contains two integers $N$ and $K$ ($1 \leq N, K \leq 300$), indicating respectively the number of days the movie festival lasts and the number of movies available for display.
The second line contains $N$ integers ${V_1}, {V_2}, \ldots, {V_N}$ ($1 \leq V_i \leq K$ for ${i}={1}, {2}, \ldots, {N}$, indicating that the movie $V_i$ will be displayed on day $i$.
Output
Output a single line with $K$ integers showing a permutation of ${1}, {2}, \ldots, {K}$ which is not a subsequence of $V$. If every permutation is a subsequence of $V$, output the character "*" (asterisk) instead.
9 3
1 2 3 1 2 3 1 2 3
11 4
1 2 3 4 2 3 3 2 4 1 4
5 6
6 5 4 3 2
*
3 4 1 2
1 2 3 4 5 6
Note
Another possible answer for the second sample would be $4\ 1\ 2\ 3$.