import java.util.Collections;
public class Solution {
public ArrayList<Integer> GetLeastNumbers_Solution(int [] input, int k) {
ArrayList<Integer> list=new ArrayList<Integer>();
int len=input.length>k?k:input.length;
for(int i=0;i<len;i++){
list.add(input[i]);
}
if(k>0){
for(int i=k;i<input.length;i++){
int e=Collections.max(list);
if(input[i]<e){
list.remove((Object)e);
list.add(input[i]);
}
}
}
return list;
}
}