Early Orders

아직 제출이 없습니다시간 제한4초메모리 제한1024 MB

문제

You are given a list of integers x_1,x_2,,x_nx\_1, x\_2, \ldots, x\_n and a number kk. It is guaranteed that each ii from 11 to kk appears in the list at least once.

Find the lexicographically smallest subsequence of xx that contains each integer from 11 to kk exactly once.

입력

The first line will contain two integers nn and kk, with 1kn200,0001\le k\le n\le 200\\,000. The following nn lines will each contain an integer x_ix\_i with 1x_ik1\le x\_i\le k.

출력

Write out on one line, separated by spaces, the lexicographically smallest subsequence of xx that has each integer from 11 to kk exactly once.