let [a,b]=readline().split(' ') let num=readline().split(' ').sort((x,y)=>{return x-y}) console.log(...num.slice(0,b))