Early Orders
题号:NC218908
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述


You are given a list of integers and a number k.
It is guaranteed that each i from 1 to k appears in the list at least once.

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

输入描述:

The first line will contain two integers n and k, with
.
The following n lines will each contain an integer x_i with
.

输出描述:

Write out on one line, separated by spaces, the lexicographically smallest
subsequence of x that has each integer from 1 to k exactly once.
示例1

输入

复制
6 3
3
2
1
3
1
3

输出

复制
2 1 3
示例2

输入

复制
10 5
5
4
3
2
1
4
1
1
5
5

输出

复制
3 2 1 4 5