You are given a list of integers x_1,x_2,…,x_n 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 1≤k≤n≤200,000. The following n lines will each contain an integer x_i with 1≤x_i≤k.
Write out on one line, separated by spaces, the lexicographically smallest subsequence of x that has each integer from 1 to k exactly once.