let str;
while(str = readline()){
  let arr = str.split(' ');
  let num = arr[1];

  let findStr = readline();
  let findArr = findStr.split(' ');

  let res = findArr.sort((a,b)=>{return a-b});
  let resArr = []
  for(let i=0;i<=num;i++){
    resArr.push(res[i])
  }
    console.log(resArr.join(' ').trim())

}