P1271 [Shenji 9. Example 1] Student Union Election

Description

The school is electing student union members. There are $n$ ($1 \le n \le 999$) candidates, and each candidate is numbered from $1$ to $n$. Now $m$ ($1 \le m \le 2000000$) ballots have been collected, and each ballot has a candidate number written on it. Now we want to sort this mountain of ballots in ascending order by the vote number. Let the number on the $i$-th ($1 \le i \le m$) ballot be $a_i$, and it is guaranteed that $1 \le a_i \le n$.

Input Format

Input $n$ and $m$, followed by the numbers on the $m$ ballots.

Output Format

Output the ballot numbers after sorting.

Explanation/Hint

Translated by ChatGPT 5