#P2369. Select the Smallest m Numbers
Select the Smallest m Numbers
Select the Smallest m Numbers
You are given n non-negative integers, each less than \(10^9\). Your task is to select and output the smallest m numbers among them in ascending order. Be cautious of potential integer overflow and note that Memory Limit is 4000KiB.
inputFormat
The first line of input contains two integers n and m. The second line contains n space-separated non-negative integers.
outputFormat
Output the smallest m numbers in ascending order, separated by a single space.
sample
5 3
4 1 3 2 5
1 2 3