while True: try: [n1,n2]=[int(i) for i in input().split()] s=[int(j) for j in input().split()] s.sort() print(' '.join(map(str,s[:n2]))) except: break #注意输入与输出的格式
while True: try: [n1,n2]=[int(i) for i in input().split()] s=[int(j) for j in input().split()] s.sort() print(' '.join(map(str,s[:n2]))) except: break #注意输入与输出的格式