시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 512 MB 12 12 12 100.000%

문제

Sean is a great code breaker (or thinks he is). He knows any cipher in the world can be broken by frequency analysis, but he has the completely the wrong idea what frequency analysis is, however.

He intercepted an enemy message. The message consists of N numbers, smaller than or equal to C.

Sean believes frequency analysis consists of sorting this sequence so that more frequent numbers appear before less frequent ones. Formally, the sequence must be sorted so that given any two numbers X and Y , X appears before Y if the number of times X appears in the original sequence is larger than the number of time Y does. If the number of appearances is equal, the number whose value appears sooner in the input should appear sooner in the sorted sequence.

Help Sean by creating a "frequency sorter".

입력

First line of input contains two integers, N (1 ≤ N ≤ 1 000), length of message, and C (1 ≤ C ≤ 1 000 000 000), the number from task description. Next line contains N integers smaller than or equal to C, message itself.

출력

First and only line of output should contain N numbers, the sorted sequence.

예제 입력 1

5 2 
2 1 2 1 2

예제 출력 1

2 2 2 1 1

예제 입력 2

9 3 
1 3 3 3 2 2 2 1 1

예제 출력 2

1 1 1 3 3 3 2 2 2

예제 입력 3

9 77 
11 33 11 77 54 11 25 25 33

예제 출력 3

11 11 11 33 33 25 25 77 54