Cipher

Sort a sequence of N integers by decreasing frequency, breaking ties by the order each value first appears in the input.

Easy3SortingHash mapImplementationInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

Sean is sure he is a great code breaker. He knows that every cipher in the world can be broken by frequency analysis, but he has the wrong idea about what frequency analysis actually is.

He intercepted an enemy message. The message consists of NN integers, each at most CC.

Sean believes frequency analysis means sorting the sequence so that more frequent numbers come before less frequent ones. Formally, if XX occurs more times than YY in the original sequence, then XX comes before YY. If two numbers occur the same number of times, the one that appears earlier in the input comes first.

Help Sean by writing a frequency sorter.

Input

The first line contains two integers: NN (1N10001 \le N \le 1000), the length of the message, and CC (1C1091 \le C \le 10^9), the number from the problem description.

The second line contains the NN integers of the message, separated by spaces. Each integer is between 1 and CC.

Output

Print the NN numbers of the sorted sequence on one line, separated by single spaces.