시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 512 MB110403645.000%

문제

You are given a sequence of n integers X = [x1, x2, ..., xn] and an integer k. It is guaranteed that 1 ≤ xi ≤ k, and every integer from 1 to k appears in the list X at least once.

Find the lexicographically smallest subsequence of X that contains each integer from 1 to k exactly once.

입력

The first line of input contains two integers n and k (1 ≤ kn ≤ 2 ∙ 105), where n is the size of the sequence, and the sequence consists only of integers from 1 to k.

Each of the next n lines contains a single integer xi (1 ≤ xik). These are the values of the sequence X in order. It is guaranteed that every value from 1 to k will appear at least once in the sequence X.

출력

Output a sequence of integers on a single line, separated by spaces. This is the lexicographically smallest subsequence of X that contains every value from 1 to k.

예제 입력 1

6 3
3
2
1
3
1
3

예제 출력 1

2 1 3

예제 입력 2

10 5
5
4
3
2
1
4
1
1
5
5

예제 출력 2

3 2 1 4 5