题号:NC224721
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
You are given a sequence of
n integers

and an integer
k.
It is guaranteed that

, and every integer from
1 to
k will 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 (

), 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
)
. 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.