import java.util.*;


public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param input int整型一维数组 
     * @param k int整型 
     * @return int整型ArrayList
     */
    public ArrayList<Integer> GetLeastNumbers_Solution (int[] input, int k) {
        // write code here
        if(k == 0) return new ArrayList<>();
        ArrayList<Integer> target = new ArrayList<>();
        Queue<Integer> queue = new PriorityQueue<>();//支持自然排序
        int loop = input.length;
        for(int i=0; i<loop; i++){
            queue.offer(input[i]);
        }

        int j=0;
        while(j < k){
            target.add(queue.poll());
            j++;
        }

        return target;
    }
}