TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

You are given a sequence of integers and a number k, you have to output k sorted smallest numbers of this sequence.

Input Format

There are several test cases, each test case start with two numbers n (1<=n<=1000000) and k (1<=k<=n). n is the size of sequence.

Output Format

For each test case, output a sequence on a line.

Sample Input 1

5 3
8 3 9 3 100
10 2
10 9 8 7 6 5 4 3 2 1

Sample Output 1

3 3 8
1 2

Hints

Try to solve this problem in 5 minutes.

Problem Source

Migrated from old NTUJ.

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 65536 6000