import java.util.Scanner; import java.util.Arrays; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int total = scan.nextInt(); int k = scan.nextInt(); int [] num = new int[total]; for(int i = 0;i < total; i++){ int x = scan.nextInt(); num[i] = x; } Arrays.sort(num); for(int i = 0;i < k; i++){ System.out.print(num[i]+ " "); } } }