You're given an array $a$. You should repeat the following operation $k$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.


-----Input-----

The first line contains integers $n$ and $k$ $(1 \le n,k \le 10^5)$, the length of the array and the number of operations you should perform.

The second line contains $n$ space-separated integers $a_1, a_2, \ldots, a_n$ $(1 \le a_i \le 10^9)$, the elements of the array.


-----Output-----

Print the minimum non-zero element before each operation in a new line.


-----Examples-----
Input
3 5
1 2 3

Output
1
1
1
0
0

Input
4 2
10 3 5 3

Output
3
2



-----Note-----

In the first sample:

In the first step: the array is $[1,2,3]$, so the minimum non-zero element is 1.

In the second step: the array is $[0,1,2]$, so the minimum non-zero element is 1.

In the third step: the array is $[0,0,1]$, so the minimum non-zero element is 1.

In the fourth and fifth step: the array is $[0,0,0]$, so we printed 0.

In the second sample:

In the first step: the array is $[10,3,5,3]$, so the minimum non-zero element is 3.

In the second step: the array is $[7,0,2,0]$, so the minimum non-zero element is 2.

Difficulty: EASY
Tags: Sorting

Implementation
Skill types: Sorting

Starter code:

Solutions:
(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
sa = set(a)
if 0 in sa:
	sa.remove(0)
lsa = list(sa)
lsa.sort()
ds = 0
for i in range(k):
	if i >= len(lsa):
		print(0)
	else:
		print(lsa[i] - ds)
		ds = lsa[i]


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
st = 0
i = 0
s = 0
while st != k:
	if i == len(a):
		print(0)
		st += 1
	elif a[i] - s <= 0:
		i += 1
	else:
		print(a[i] - s)
		s = a[i]
		i += 1
		st += 1


(n, k) = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
arr = list(set(arr))
arr.sort()
m = 0
for i in arr[:k]:
	print(i - m)
	m += i - m
for i in range(k - len(arr)):
	print(0)


def run():
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	arr.sort()
	total = 0
	i = 0
	while k > 0:
		if i < n:
			if i == 0 and arr[i] != 0:
				print(arr[i])
				total += arr[i]
				k -= 1
			elif arr[i] - total != 0:
				arr[i] -= total
				print(arr[i])
				total += arr[i]
				k -= 1
			i += 1
		elif i >= n and k > 0:
			print(0)
			k -= 1
run()


R = lambda : map(int, input().split())
(n, k) = R()
a = sorted(R())
i = m = 0
while k:
	while a[i] <= m and i < n - 1:
		i += 1
	print(a[i] - m)
	m += a[i] - m
	k -= 1


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
count = {}
for i in a:
	count[i] = count.get(i, 0) + 1
j = 0
sub = 0
for i in range(k):
	if j == n:
		print(0)
		continue
	mi = a[j]
	mi = mi - sub
	j += count[a[j]]
	mi = max(mi, 0)
	print(mi)
	sub += mi


(n, times) = input().split()
times = int(times)
array = input().split()
array = [int(a) for a in array]
array = sorted(array)
count = 0
limitter = 0
count_prints = 0
while count < len(array):
	if count_prints >= times:
		break
	if array[count] - limitter > 0:
		print(array[count] - limitter)
		count_prints += 1
		limitter = array[count]
	count += 1
while count_prints < times:
	print(0)
	count_prints += 1


(n, k) = map(int, input().split())
array = set(map(int, input().split()))
array = list(array)
array.sort()
i = 0
count = 0
for j in range(k):
	if i >= len(array):
		print(0)
	else:
		print(array[i])
		count = count + array[i]
		if i + 1 < len(array):
			array[i + 1] = array[i + 1] - count
		i = i + 1


from sys import stdin, stdout
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, stdin.readline().split()))
for _ in range(1):
	(n, k) = lst()
	a = lst()
	a.sort()
	sub = 0
	for i in range(n):
		if k == 0:
			break
		a[i] -= sub
		if a[i] == 0:
			continue
		print(a[i])
		sub += a[i]
		k -= 1
	while k > 0:
		print(0)
		k -= 1


(n, k) = map(int, input().split())
l = sorted(list(map(int, input().split())))
(a, m) = (0, 0)
for i in l:
	if i == a:
		continue
	if m == k:
		break
	print(i - a)
	a = i
	m += 1
while m < k:
	print(0)
	m += 1


(n, k) = map(int, input().split())
l = sorted(map(int, input().split()))
x = 1
p = [l[0]]
print(l[0])
for num in l:
	if x != k:
		if num == p[-1]:
			pass
		else:
			print(abs(p[-1] - num))
			p.append(num)
			x += 1
	else:
		break
while x != k:
	print(0)
	x += 1


def mainA():
	n = int(input())
	if n == 1:
		print(-1)
	else:
		print(n, n)

def mainB():
	(n, k) = map(int, input().split())
	a = set([int(e) for e in input().split()])
	a = [0] + sorted(a)
	for i in range(1, min(k + 1, len(a))):
		print(a[i] - a[i - 1])
	if k > len(a) - 1:
		for i in range(k - len(a) + 1):
			print(0)
mainB()


firstLine = list(map(int, input().split(' ')))
arrLen = firstLine[0]
numberOfOperations = firstLine[1]
numberArray = list(set(list(map(int, input().split(' ')))))
numberArray.sort()
arrLen = len(numberArray)
if arrLen >= 1:
	if numberArray[arrLen - 1] == 0:
		for i in range(numberOfOperations):
			print(0)
		exit()
	totalSum = 0
	for i in range(numberOfOperations):
		if i > arrLen - 1:
			print(0)
			continue
		else:
			smallest = numberArray[i] - totalSum
			print(smallest)
			totalSum += smallest


times = [int(x) for x in input().split()]
numList = [int(x) for x in input().split()]
numList = sorted(list(dict.fromkeys(numList)))
index = 0
amountReduced = 0
while times[1] != 0:
	if index < len(numList):
		result = numList[index] - amountReduced
		print(result)
		amountReduced += result
		index += 1
	else:
		print(0)
	times[1] -= 1


import math
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def main():
	(n, k) = map(int, input().split())
	arr = set(list(map(int, input().split())))
	arr = sorted(list(arr))
	num = None
	i = 0
	ter = 0
	while ter < k:
		if num == None:
			num = arr[i]
			print(arr[i])
			arr[i] -= num
		else:
			arr[i] -= num
			arr[i] = max(0, arr[i])
			print(arr[i])
			num += arr[i]
		i = (i + 1) % len(arr)
		ter += 1
t = 1
for _ in range(t):
	main()


(n, k) = map(int, input().split())
l = sorted(map(int, input().split()))
curr = curr_i = i = 0
while i < k:
	if curr_i >= n:
		print(0)
		i += 1
	else:
		l[curr_i] -= curr
		if l[curr_i] > 0:
			print(l[curr_i])
			curr += l[curr_i]
			i += 1
	curr_i += 1


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
sarr = sorted(set(arr))
s = 0
for i in range(k):
	if i >= len(sarr):
		print(0)
	else:
		print(sarr[i] - s)
		s += sarr[i] - s


from sys import stdin
import math
(n, k) = list(map(int, stdin.readline().split()))
arr = list(map(int, stdin.readline().split()))
arr.sort()
i = 0
diff = 0
while i < n and k > 0:
	while i < n and arr[i] - diff <= 0:
		i += 1
	if i < n:
		print(arr[i] - diff)
		diff = arr[i]
		k -= 1
		i += 1
while k > 0:
	print(0)
	k -= 1


[n, k] = [int(x) for x in input().split(' ')]
A = [int(x) for x in input().split(' ')]
A.sort()
totalSubtraction = 0
i = 0
for _ in range(k):
	if i >= n:
		print(0)
	else:
		while i < n and A[i] - totalSubtraction == 0:
			i += 1
		if i >= n:
			print(0)
		else:
			print(A[i] - totalSubtraction)
			if A[i] - totalSubtraction >= 0:
				totalSubtraction += A[i] - totalSubtraction
			i += 1


x = input().split()
n = int(x[0])
k = int(x[1])
mass = [int(i) for i in input().split()]
index = 0
mass = sorted(list(set(mass)))
print(mass[0])
for i in range(1, k):
	if len(mass) > i:
		print(mass[i] - mass[i - 1])
	else:
		print(0)


str = input()
lst = list(map(int, str.split()))
(n, k) = (lst[0], lst[1])
str1 = input()
arr = list(map(int, str1.split()))
n = len(arr)
arr.sort()
temp = 0
j = 0
for i in range(k):
	if j != 0 and j < n:
		while j < n and arr[j] == arr[j - 1]:
			j = j + 1
	if j < n:
		print(arr[j] - temp)
		temp = arr[j]
		j = j + 1
	else:
		print(0)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
prev = 0
ind = 0
for i in range(k):
	if ind == n:
		print(0)
		continue
	for j in range(ind + 1, n):
		if l[j] != l[ind]:
			break
		else:
			ind = j
	print(l[ind] - prev)
	prev = l[ind]
	ind += 1


(n, k) = map(int, input().split())
t = list(set(list(map(int, input().split()))))
t.sort()
f = 1
if len(t) == 1:
	if k == 1:
		print(t[0])
	else:
		for v in range(k):
			if v == 0:
				print(t[0])
			else:
				print(0)
else:
	for x in range(k):
		if x == 0:
			print(t[0])
		elif f <= len(t) - 1:
			print(t[f] - t[f - 1])
			f += 1
		else:
			print(0)


(_, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a = sorted(set(a))
s = 0
j = 0
for i in range(k):
	if i >= len(a):
		print(0)
		continue
	print(a[i] - s)
	s += a[i] - s


def ia():
	return list(map(int, input().split()))

def ca():
	return input().split()

def ii():
	return int(input())
(n, i) = ia()
a = ia()
a = list(sorted(a))
j = 0
k = 0
for i in range(i):
	if j < n:
		p = a[j] - k
		k += a[j] - k
		while j < n - 1 and a[j] == a[j + 1]:
			j += 1
		print(p)
		j += 1
	else:
		print(0)


(n, k) = map(int, input().split())
a = sorted(list(set(map(int, input().split()))))
s = 0
for i in range(k):
	if i > len(a) - 1:
		print(0)
	else:
		print(a[i] - s)
		s = a[i]


def operations(numbers, k):
	numbers.sort()
	i = 0
	val = 0
	while k:
		print(numbers[i])
		val += numbers[i]
		i += 1
		if i == len(numbers):
			k -= 1
			while k:
				print('0')
				k -= 1
			return
		numbers[i] -= val
		k -= 1
(n, k) = tuple(map(int, input().strip().split(' ')))
numbers = list(set(map(int, input().strip().split(' '))))
operations(numbers, k)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
(s, i) = (0, 0)
ans = []
while len(ans) < k:
	if i < n:
		if l[i] - s == 0:
			i += 1
			continue
		ans.append(l[i] - s)
		s += l[i] - s
		i += 1
	else:
		ans.append(0)
for i in ans:
	print(i)


nk = list(map(int, input().rstrip().split()))
n = nk[0]
k = nk[1]
unique = list(map(int, input().rstrip().split()))
unique.sort()
subtotal = 0
i = 0
while i < k:
	if i >= len(unique):
		print(0)
		i = i + 1
	elif unique[i] - subtotal == 0:
		i = i + 1
		k = k + 1
	else:
		print(unique[i] - subtotal)
		subtotal += unique[i] - subtotal
		i = i + 1


import sys

def main():
	(n, k) = map(int, sys.stdin.readline().split())
	a = list(map(int, sys.stdin.readline().split()))
	a.sort(reverse=True)
	while len(a) and a[-1] <= 0:
		a.pop(-1)
	a.reverse()
	d = 0
	i = 0
	ind = 0
	for i in range(k):
		if ind < n:
			while ind < n and a[ind] - d <= 0:
				ind += 1
			if ind == n:
				print(0)
			else:
				print(a[ind] - d)
				d += a[ind] - d
		else:
			print(0)
main()


(n, k) = [int(i) for i in input().split()]
nums = [int(i) for i in input().split()]
nums.sort()
aux = 0
i = 0
for _ in range(k):
	if i >= n or nums[n - 1] - aux == 0:
		print('0')
		continue
	while nums[i] - aux <= 0 and i < n:
		i += 1
	print(str(nums[i] - aux))
	aux += nums[i] - aux


from sys import stdin, stdout
(n, m) = map(int, stdin.readline().strip().split())
s = list(map(int, stdin.readline().strip().split()))
s = list(set(s))
s.sort()
acum = 0
n = len(s)
r = ''
for i in range(min(n, m)):
	r += str(s[i] - acum) + '\n'
	acum += s[i] - acum
d = 0
if m > n:
	d = m - n
for i in range(d):
	r += '0\n'
stdout.write(r)


R = lambda : map(int, input().split())
(n, k) = R()
a = iter(sorted(R()))
p = 0
while k:
	x = next((x for x in a if x > p), p)
	print(x - p)
	p = x
	k -= 1


(n, k) = list(map(int, input().strip().split()))
nums = list(set(map(int, input().strip().split())))
n = len(nums)
nums.sort()
sumv = 0
j = 0
for i in range(k):
	if j == n:
		print(0)
	else:
		print(nums[j] - sumv)
		sumv += nums[j] - sumv
		j += 1


(n, k) = map(int, input().split(' '))
b = list(map(int, input().split(' ')))
b.sort()
s = 0
tk = 0
temp = 0
for i in range(len(b)):
	s = b[i] - temp
	if s != 0:
		tk += 1
		print(s)
		temp += s
	if tk == k:
		break
if k - tk != 0:
	for _ in range(k - tk):
		print(0)


(n, k) = map(int, input().split())
x = list(map(int, input().split()))
x = list(set(x))
x.sort()
ans = 0
if k <= len(x):
	for i in range(k):
		print(x[i] - ans)
		ans += x[i] - ans
else:
	for i in range(len(x)):
		print(x[i] - ans)
		ans += x[i] - ans
	for j in range(k - len(x)):
		print(0)


(n, k) = map(int, input().split())
l = [int(s) for s in input().split()]
l.sort()
print(l[0])
k1 = 1
if k1 != k:
	for i in range(1, n):
		if l[i] - l[i - 1] != 0:
			print(l[i] - l[i - 1])
			k1 += 1
		if k1 == k:
			break
	while k1 < k:
		print(0)
		k1 += 1


(n, k) = map(int, input().split())
a = sorted(list(set(map(int, input().split()))))
if 0 in a:
	a.remove(0)
q1 = 0
for q in range(k):
	if q < len(a):
		print(a[q] - q1)
		q1 += a[q] - q1
	else:
		print(0)


(n, k) = map(int, input().split())
l = sorted(set(map(int, input().split())))
z = l[0]
print(z)
for i in range(1, k):
	if i < len(l):
		print(l[i] - z)
		z = l[i]
	else:
		print('0')


(n, k) = map(int, input().split())
arr = list(sorted(set([int(x) for x in input().split() if int(x) > 0])))
n = len(arr)
if k > n:
	arr[n:k] = [arr[n - 1]] * (k - n)
	n = k
d = 0
for i in range(min(n, k)):
	print(arr[i] - d)
	d = arr[i]


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = sorted(list(set(a)))
if b[0] == 0:
	b = b[1:]
res = []
pre = 0
for item in b:
	res.append(item - pre)
	pre = item
if len(res) >= k:
	for item in res[:k]:
		print(item)
else:
	for item in res:
		print(item)
	for i in range(k - len(res)):
		print(0)


i = lambda : map(int, input().split())
(n, k) = i()
a = sorted(i())
c = i = 0
while k:
	while i < n and a[i] == c:
		i += 1
	if i < n:
		print(a[i] - c)
		c = a[i]
	else:
		print(0)
	k -= 1


R = lambda : [int(x) for x in input().split()]
(n, m) = R()
last = 0
given = sorted(set(R()), reverse=True)
for _ in range(m):
	if given:
		current = given.pop()
		print(current - last)
		last = current
	else:
		print(0)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
i = 0
c = 0
while k:
	if i >= n:
		print('0')
		k -= 1
		continue
	if a[i] - c != 0:
		print(a[i] - c)
		c = a[i]
		i += 1
		k -= 1
	else:
		i += 1


import copy
(n, k) = map(int, input().split())
row = list(map(int, input().split()))
row.sort()
promise = 0
for i in range(k):
	try:
		while row[0] == 0 or row[0] == promise:
			row.pop(0)
		print(row[0] - promise)
		promise += row[0] - promise
	except:
		print(0)


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
a.sort()
p = a[0]
print(p)
m = 1
for i in range(1, n):
	if a[i] > p:
		a[i] -= p
		if m < k:
			print(a[i])
			m += 1
		p += a[i]
	else:
		a[i] = 0
for i in range(k - m):
	print(0)


R = lambda : list(map(int, input().split()))
(n, m) = R()
l = sorted(list(set(R())))
k = [l[i] - l[i - 1] if i > 0 else l[i] for i in range(len(l))]
for i in range(m):
	if i < len(k):
		print(k[i])
	else:
		print(0)


import sys
import math
input = sys.stdin.readline
(n, k) = map(int, input().split())
a_in_list = list(map(int, input().split()))
a_list = list(set(a_in_list))
a_list.sort()
sub_total = 0
for i in range(min(len(a_list), k)):
	print(a_list[i] - sub_total)
	sub_total += a_list[i] - sub_total
if len(a_list) < k:
	for _ in range(k - len(a_list)):
		print(0)


(n, k) = list(map(int, input().split()))
l = list(map(int, input().split()))
s = list(set(l))
s.sort()
s = s[:k] + [0 for i in range(k)]
a = 0
for i in range(k):
	print(max(0, s[i] - a))
	a = s[i]


(n, m) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
b = list(set(a))
b.sort()
k = 0
for i in range(m):
	if i >= len(b):
		print(0)
	else:
		print(b[i] - k)
		k += b[i] - k


(n, k) = map(int, input().split())
arr = sorted(set(list(map(int, input().split()))), reverse=True)
arr = [i for i in arr if i != 0]
last = 0
while k > 0 and arr:
	x = arr.pop()
	print(x - last)
	last = x
	k -= 1
while k > 0:
	print(0)
	k -= 1


def solve():
	(n, k) = map(int, input().split())
	A = [int(k) for k in input().split()]
	A = sorted(set(A))
	decr = 0
	results = []
	i = 0
	while i < k and i < len(A):
		results.append(A[i] - decr)
		decr = A[i]
		i += 1
	if k >= len(A):
		for i in range(k - len(A)):
			results.append(0)
	print('\n'.join((str(k) for k in results)))
solve()


(n, k) = input().split(' ')
n = int(n)
k = int(k)
go = []
for i in input().split(' '):
	go.append(int(i))
go = sorted(go)
cnt = 0
j = 0
while k > 0:
	k -= 1
	while j < len(go) and go[j] <= cnt:
		j += 1
	if j < len(go):
		print(go[j] - cnt)
		cnt = go[j]
	else:
		print(0)


(n, k) = input().split()
n = int(n)
k = int(k)
a = [int(i) for i in input().split()]
a.sort()
t = 0
z = 0
h = 0
for i in range(n):
	t = a[i] - h
	if t > 0:
		print(t)
		h = h + t
		z = z + 1
	if z == k:
		break
if z < k:
	for i in range(k - z):
		print(0)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a1 = list(set(a))
a1.sort()
print(a1[0])
for i in range(1, k):
	if i < len(a1):
		print(a1[i] - a1[i - 1])
	else:
		print(0)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
sub = 0
sp = 0
a.sort()
for i in range(0, k):
	if sp == n:
		print(0)
		continue
	while a[sp] == sub:
		sp += 1
		if sp == n:
			break
	if sp == n:
		print(0)
		continue
	print(a[sp] - sub)
	sub = a[sp]
	sp += 1


(n, k) = input().split()
k = int(k)
l = [int(x) for x in input().split() if int(x) != 0]
l.sort()
p = 0
soma_total = 0
for i in range(k):
	if p < len(l):
		current = l[p]
		print('{}'.format(current - soma_total))
		soma_total += l[p] - soma_total
		while p < len(l) and current == l[p]:
			current = l[p]
			p += 1
	else:
		print(0)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = iter(sorted(set(a)))
p = 0
for i in range(k):
	ans = next(b, p)
	print(ans - p)
	p = ans


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
c = 0
d = 0
e = 1
x = 0
while e != 0 and x < k:
	if d >= n:
		break
	elif c == a[d]:
		d += 1
	else:
		e = a[d] - c
		print(e)
		c = a[d]
		d += 1
		x += 1
for i in range(x, k):
	print('0')


(n, k) = map(int, input().split())
a = list(sorted(set(map(int, input().split()))))
print(a[0])
print('\n'.join([str(a[i] - a[i - 1]) for i in range(1, min(k, len(a)))]))
print('\n'.join('0' * (k - len(a))))


def minaftersubtract(arr, num):
	arr.sort()
	print(arr[0])
	le = len(arr)
	i = 1
	j = 1
	while le > i and j < num:
		if arr[i] == arr[i - 1]:
			i += 1
			continue
		else:
			print(arr[i] - arr[i - 1])
			j += 1
		i += 1
	while j < num:
		print(0)
		j += 1
(noe, k) = map(int, input().split())
arr = list(map(int, input().split()))
minaftersubtract(arr, k)


(n, k) = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort()
a = []
for i in range(n):
	if i == 0:
		a.append(l[i])
		continue
	if l[i] != l[i - 1]:
		a.append(l[i])
mus = a[0]
ans = [a[0]]
for i in range(1, len(a)):
	if len(ans) == k:
		break
	if a[i] - mus > 0:
		a[i] -= mus
		ans.append(a[i])
		mus += a[i]
ans += [0] * (k - len(ans))
for i in range(k):
	print(ans[i])


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a = list(set(a) - {0})
a.sort()
diff = 0
for i in range(k):
	if i >= len(a):
		print(0)
	else:
		print(max(0, a[i] - diff))
		diff = a[i]


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
mini = 0
p = 0
for i in range(n):
	if l[i] - mini != 0:
		print(l[i] - mini)
		mini = l[i]
		l[i] = 0
		p += 1
	if p == k:
		break
if k - p > 0:
	for j in range(k - p):
		print('0')


(n, k) = [int(x) for x in input().split()]
numbers = sorted((int(x) for x in input().split()))
s = 0
pos = 0
for i in range(k):
	if pos == n:
		print(0)
		continue
	print(numbers[pos] - s)
	s += numbers[pos] - s
	while pos < n - 1 and numbers[pos] == numbers[pos + 1]:
		pos += 1
	pos += 1


(n, k) = map(int, input().split())
a = sorted(list(map(int, input().split())))
s = 0
m = 0
i = 0
while m < k and i < n:
	if a[i] - s > 0:
		print(a[i] - s)
		s += a[i] - s
		m += 1
	i += 1
for i in range(k - m):
	print(0)


def __starting_point():
	(n, k) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	count = 0
	for i in range(k):
		if n == 0:
			print(0)
		else:
			rem = arr[-1]
			print(arr[-1] - count)
			count += arr[-1] - count
			check = arr[-1]
			while n > 0 and check == arr[-1]:
				arr.pop()
				n -= 1
__starting_point()


from sys import stdin, stdout
from math import *
from heapq import *
from collections import *

def main():
	(n, k) = [int(x) for x in stdin.readline().split()]
	a = [int(x) for x in stdin.readline().split()]
	a.sort()
	s = 0
	i = 0
	for _ in range(k):
		while i < n:
			if a[i] - s == 0:
				i = i + 1
			else:
				break
		if i >= n:
			stdout.write('0\n')
			continue
		stdout.write(str(a[i] - s) + '\n')
		s = a[i]
	return 0
main()


def main():
	buf = input()
	buflist = buf.split()
	n = int(buflist[0])
	k = int(buflist[1])
	buf = input()
	buflist = buf.split()
	a = list(map(int, buflist))
	a = list(sorted(a))
	pos = 0
	neg = 0
	for i in range(k):
		if pos < len(a):
			print(a[pos] - neg)
			neg = a[pos]
		else:
			print(0)
		while pos < len(a):
			if a[pos] - neg <= 0:
				pos += 1
			else:
				break
main()


(n, k) = map(int, input().split())
a = sorted(list(map(int, input().split())))
(i, j) = (0, 0)
while k:
	while a[i] - j <= 0 and i < n - 1:
		i += 1
	print(a[i] - j)
	j += a[i] - j
	k -= 1


(n, k) = map(int, input().split())
a = sorted(list(map(int, input().split())))
sub = 0
i = 0
cnt = 0
while i < n and cnt < k:
	if a[i] - sub == 0:
		i += 1
		continue
	print(a[i] - sub)
	sub += a[i] - sub
	cnt += 1
while cnt < k:
	cnt += 1
	print(0)


(n, k) = input().split()
(n, k) = [int(n), int(k)]
array_list = input().split()
array_list = list(map(int, array_list))
array_list = list(set(array_list))
if 0 in array_list:
	array_list.remove(0)
array_list.sort()
a = 0
for i in range(k):
	if len(array_list) > 0:
		b = array_list.pop(0) - a
		a = a + b
		print(b)
	else:
		print(0)


import bisect
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
total = 0
for _ in range(k):
	i = bisect.bisect_left(arr, total + 1)
	if i >= n:
		print(0)
		continue
	print(arr[i] - total)
	total += arr[i] - total


(a, b) = map(int, input().split())
c = list(map(int, input().split()))
c.sort()
d = 0
k = 0
i = 0
while k < b:
	if i < a:
		c[i] -= d
		if c[i] == 0:
			i += 1
			continue
		print(c[i])
		k += 1
		d += c[i]
	else:
		print(0)
		k += 1
	i += 1


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
b = [a[0]]
for i in range(1, n):
	b.append(a[i] - a[i - 1])
c = 0
for i in b:
	if i > 0:
		print(i)
		c += 1
	if c == k:
		break
while c < k:
	print(0)
	c += 1


(n, k) = [int(x) for x in input().split()]
numbers = [int(x) for x in input().split()]
numbers = set(numbers)
numbers = list(numbers)
numbers.sort()
if k > len(numbers):
	for e in range(len(numbers)):
		if e == 0:
			print(numbers[0])
		else:
			print(numbers[e] - numbers[e - 1])
	for e in range(k - len(numbers)):
		print(0)
else:
	for e in range(k):
		if e == 0:
			print(numbers[0])
		else:
			print(numbers[e] - numbers[e - 1])


(n, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a = sorted(a)
c = 0
count = 0
for i in range(0, len(a)):
	if c < a[i]:
		print(a[i] - c)
		c = a[i]
		count = count + 1
	else:
		pass
	if count == m:
		break
while count < m:
	print(0)
	count = count + 1


(n, k) = map(int, input().split())
li = input().split()
for i in range(n):
	li[i] = int(li[i])
li.sort()
sum = li[0]
c = 0
z = 0
while z < k:
	if li[n - 1] == 0:
		print(0)
		z += 1
		continue
	if c == n - 1:
		print(li[c])
		z += 1
		li[c] = 0
		continue
	if li[c] > 0:
		print(li[c])
	li[c + 1] = li[c + 1] - sum
	if li[c] > 0:
		z += 1
	li[c] = 0
	sum += li[c + 1]
	c += 1
	j = 0


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
k1 = list(set(l))
k1.sort(reverse=True)
t = 0
r = 0
t = len(k1)
for i in range(k):
	print(k1[-1])
	r = r + k1[-1]
	k1.pop()
	t = t - 1
	if t:
		k1[-1] = k1[-1] - r
	else:
		break
for i in range(k - i - 1):
	print(0)


(n, k) = map(int, input().split())
l = list(set(list(map(int, input().split()))))
l.sort()
dif = l[0]
nu = []
nu.append(l[0])
for i in l[1:]:
	nu.append(i - dif)
	dif = dif + i - dif
count = 0
for i in range(k):
	if count < len(nu):
		print(nu[i])
		count = count + 1
	else:
		print(0)


def solve(n, k, a):
	result = []
	a = sorted(a)
	total = 0
	i = 0
	while i < n:
		while i < n and a[i] - total == 0:
			i += 1
		if i >= n:
			break
		result.append(a[i] - total)
		total = a[i]
		i += 1
	while len(result) < k:
		result.append(0)
	result = result[:k]
	return '\n'.join((str(x) for x in result))
(n, k) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
print(solve(n, k, a))


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = a.copy()
a.sort()
ind = 0
s = 0
while a[ind] == 0 and ind != n - 1:
	ind += 1
for i in range(k):
	q = a[ind]
	while a[ind] == q and ind != n - 1:
		ind += 1
	print(q - s)
	s += q - s


(dai, lan) = map(int, input().split())
chuoi = list(map(int, input().split()))
chuoi.sort()
tru = 0
dem = 0
het = False
for i in range(lan):
	if het:
		print('0')
		continue
	for j in range(dem, dai):
		phantu = chuoi[j]
		if phantu > tru:
			print(phantu - tru)
			tru += phantu - tru
			dem = j
			break
	else:
		print('0')
		het = True


def main():
	(n, k) = map(int, input().split())
	a = list(set(map(int, input().split())))
	a.sort()
	i = 0
	n = len(a)
	temp_sum = 0
	while k:
		if i < n and a[i] > 0:
			print(a[i])
			if i < n - 1:
				temp_sum += a[i]
				a[i + 1] -= temp_sum
		else:
			print(0)
		k -= 1
		i += 1
main()


import sys
input = sys.stdin.readline
(n, k) = list(map(int, input().split()))
A = list(map(int, input().split()))
A.append(0)
A = list(set(A))
A.sort()
ANS = []
for i in range(1, len(A)):
	ANS.append(A[i] - A[i - 1])
ANS += [0] * (k - len(ANS))
for a in ANS[:k]:
	print(a)


(t, k) = (int(i) for i in input().split())
a = list(set([int(i) for i in input().split()]))
a.sort()
total = 0
i = 0
for i in range(k):
	if a[-1] - total == 0:
		print(0)
	else:
		print(a[i] - total)
		total += a[i] - total


def main():
	(n, k) = map(int, input().split())
	array = list(map(int, input().split()))
	array.sort()
	current = array[0]
	dist_elements = [current]
	for i in array:
		if i != current:
			current = i
			dist_elements.append(current)
	dist_elements.sort()
	count = 0
	current = dist_elements[count]
	subtract = current
	for i in range(k):
		print(current)
		count += 1
		if count == len(dist_elements):
			count -= 1
		current = dist_elements[count] - subtract
		if current < 0:
			current = 0
		subtract += current
main()


(n, k) = map(int, input().split())
a = sorted(set(map(int, input().split())))
cur = 0
l = len(a)
for i in range(k):
	if i < l:
		print(a[i] - cur)
		cur = a[i]
	else:
		print(0)


def mi():
	return map(int, input().split())
(n, k) = mi()
a = list(set(mi()))
n = len(a)
a.sort()
i = 0
res = 0
while k:
	k -= 1
	while i < n and a[i] <= 0:
		i += 1
	if i == n:
		print(0)
		continue
	a[i] -= res
	res += a[i]
	while i < n and a[i] <= 0:
		i += 1
	if i == n or a[i] <= 0:
		print(0)
		continue
	print(a[i])
	i += 1


(n, k) = map(int, input().split())
mass = [int(i) for i in input().split()]
mass.sort()
new_mass = []
if mass[0] != 0:
	new_mass.append(mass[0])
for i in range(1, len(mass)):
	if mass[i] - mass[i - 1] != 0:
		new_mass.append(mass[i] - mass[i - 1])
for i in range(min(len(new_mass), k)):
	print(new_mass[i])
if k > len(new_mass):
	for i in range(k - len(new_mass)):
		print(0)


R = lambda : map(int, input().split())
(n, k) = R()
lst = iter(sorted(set(R())))
counter = 0
while k:
	x = next(lst, counter)
	print(x - counter)
	counter = x
	k += -1


(n, k) = map(int, input().split())
nums = set(map(int, input().split()))
nums = list(nums)
nums.sort()
diffs = [nums[0]]
acu = nums[0]
for i in range(1, len(nums)):
	diffs.append(nums[i] - acu)
	acu += nums[i] - acu
size = len(diffs)
for i in range(k):
	if i >= size:
		print(0)
	else:
		print(diffs[i])


(n, k) = input().split()
n = int(n)
k = int(k)
a = input().split()
a = [int(x) for x in a]
a = sorted(a)
p = 0
minimo = a[0]
somamin = 0
for i in range(k):
	while p < n - 1 and a[p] - somamin <= 0:
		p += 1
	if a[p] - somamin > 0:
		print(a[p] - somamin)
	else:
		print(0)
	somamin += a[p] - somamin


import math
import sys
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
red = 0
i = 0
while k != 0:
	if i >= n:
		print(0)
		k -= 1
	else:
		while a[i] == 0 or a[i] - red == 0:
			i += 1
			if i == n:
				i -= 1
				break
		print(a[i] - red)
		red += a[i] - red
		i += 1
		k -= 1


import math
(n, k) = map(int, input().split())
list = [int(i) for i in input().split()]
(a, i) = (0, 0)
list.sort()
while i < k and i < n:
	if list[i] != a:
		print(list[i] - a)
	else:
		k += 1
	a = list[i]
	i += 1
if k == max(n, k):
	print('0\n' * (k - n))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a = set(a)
b = list(a)
b.sort()
i = 1
print(b[0])
k = k - 1
while k > 0:
	if i == len(a):
		print('0')
	else:
		print(b[i] - b[i - 1])
		i = i + 1
	k = k - 1


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
a = sorted(map(int, input().split()))
last = 0
i = 0
while k:
	if i >= len(a):
		break
	if a[i] - last != 0:
		print(a[i] - last)
		last = a[i]
		k -= 1
	i += 1
for i in range(max(0, k)):
	print(0)


(n, k) = map(int, input().split())
a = list(map(int, set(input().split())))
a.sort()
rk = iter(range(k))
prv = 0
for (x, _) in zip(a, rk):
	print(x - prv)
	prv = x
for __ in rk:
	print('0')


(n, k) = [int(j) for j in input().split()]
arr = [int(j) for j in input().split()]
arr.sort()
i = 0
x = 0
for t in range(k):
	while arr[i] - x == 0:
		if i + 1 < n:
			i += 1
		else:
			break
	if i == n - 1 and arr[i] == 0:
		print(0)
	else:
		print(arr[i] - x)
		x += arr[i] - x


(n, k) = [int(j) for j in input().split()]
a = [int(j) for j in input().split()]
s = set()
for i in a:
	s.add(i)
max = 0
p = sorted(s)
for i in range(k):
	if i < len(p):
		print(p[i] - max)
		max = p[i]
	else:
		print(0)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a = sorted(a)
p = 0
cnt = 0
for i in a:
	while i - cnt > 0:
		print(i - cnt)
		cnt += i - cnt
		p += 1
		if p >= k:
			return
else:
	while p != k:
		print(0)
		p += 1


(n, k) = map(int, input().split(' '))
arr = list(map(int, input().split(' ')))
arr.sort()
(ptr, cnt) = (0, 0)
while k:
	if ptr == n:
		print(0)
		k -= 1
		continue
	else:
		print(arr[ptr] - cnt)
	cnt += arr[ptr] - cnt
	while ptr < n and arr[ptr] - cnt <= 0:
		ptr += 1
	k -= 1


import heapq

def foo(n, k, a):
	heapq.heapify(a)
	prev_min = 0
	counter = 0
	while a != [] and counter < k:
		next_min = heapq.heappop(a)
		if next_min == prev_min:
			continue
		if next_min - prev_min > 0:
			print(next_min - prev_min)
			prev_min = next_min
			counter += 1
		else:
			print(0)
			counter += 1
	for i in range(k - counter):
		print(0)
(n, k) = list(map(int, input().strip().split(' ')))
x = list(map(int, input().strip().split(' ')))
foo(n, k, x)


import sys

def rint():
	return map(int, sys.stdin.readline().split())
(n, k) = rint()
a = list(rint())
a.sort()
adiff = [a[0]]
for i in range(1, n):
	adiff.append(a[i] - a[i - 1])
cnt = 0
i = 0
while cnt < k:
	if i > n - 1:
		print(0)
		cnt += 1
		i += 1
		continue
	if i == 0:
		print(a[0])
		i += 1
		cnt += 1
		continue
	if adiff[i] > 0:
		print(adiff[i])
		i += 1
		cnt += 1
	else:
		i += 1


(n, k) = map(int, input().split())
i = 0
a = [int(s) for s in input().split()]
a = sorted(a)
mn = 0
x = 1
pos = 0
while x <= k:
	if pos < n and a[pos] - mn > 0:
		print(a[pos] - mn)
		mn += a[pos] - mn
	else:
		while pos < n and a[pos] - mn <= 0:
			pos += 1
		if pos >= n:
			print('0')
		else:
			print(a[pos] - mn)
			mn += a[pos] - mn
	x += 1


(n, k) = map(int, input().split())
m = list(map(int, input().split()))
m = list(filter(lambda x: x != 0, m))
m.sort()
step = 0
ptr = 0
eptr = 0
while k > 0:
	if ptr >= n:
		print(0)
		k -= 1
	elif ptr == 0:
		print(m[ptr])
		step = m[ptr]
		eptr = ptr + 1
		while eptr < n - 1 and m[eptr] == m[ptr]:
			eptr += 1
		ptr = eptr
		k -= 1
	else:
		print(m[ptr] - step)
		step += m[ptr] - step
		eptr = ptr + 1
		while eptr < n - 1 and m[eptr] == m[ptr]:
			eptr += 1
		ptr = eptr
		k -= 1


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l = list(set(l))
l.sort()
prev = 0
for i in range(k):
	if i > len(l) - 1:
		i = len(l) - 1
	x = l[i] - prev
	if x < 0:
		x = 0
	print(x)
	prev = l[i]


(x, y) = map(int, input().split())
p = 0
a = list(sorted(set(map(int, input().split())))) + [0]
for i in range(y):
	if i >= len(a) - 1:
		print(0)
		continue
	print(a[i])
	p += a[i]
	a[i + 1] -= p


(n, k) = input().split()
n = int(n)
k = int(k)
total = 0
a = [int(i) for i in input().split()]
a.sort()
j = 0
for i in range(k):
	while j < n:
		if a[j] - total <= 0:
			j += 1
		else:
			break
	if j < n:
		print(a[j] - total)
		total += a[j] - total
	else:
		print(0)


(n, k) = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a = sorted(set(b))
i = 0
t = 0
temp = 0
while t < k:
	if i < len(a):
		print(a[i] - temp)
		temp = a[i]
		i = i + 1
		t = t + 1
	else:
		print('0')
		t = t + 1


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
q = 0
s = 0
for i in range(k):
	if q >= n:
		print(0)
	else:
		while q < n:
			if a[q] - s <= 0:
				q += 1
			else:
				break
		if q >= n:
			print(0)
		else:
			a[q] -= s
			print(a[q])
			s += a[q]
			a[q] = 0


import math

def read():
	return map(int, input().split())

def readAll():
	return (int(i) for i in input().split())

def solve():
	(n, k) = readAll()
	vec = list(readAll())
	vec.sort()
	sum = 0
	for i in range(k):
		if len(vec) is 0:
			print(0)
		else:
			while len(vec) > 0 and vec[0] - sum <= 0:
				vec.remove(vec[0])
			if len(vec) == 0:
				print(0)
			else:
				print(vec[0] - sum)
				add = vec[0] - sum
				sum += add
	return
solve()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
m = 0
a.sort()
d = 0
i = 0
while i < n and d < k:
	if a[i] > m:
		print(a[i] - m)
		m += a[i] - m
		d += 1
	i += 1
if d < k:
	for i in range(k - d):
		print(0)


(n, op) = map(int, input().split())
l = list()
for i in input().split():
	l.append(int(i))
l = set(l)
l = list(l)
l.sort()
s = 0
while op > 0:
	if l[0] > 0:
		print(l[0])
	while l[0] == 0:
		l[0].pop(0)
	if len(l) == 0:
		break
	x = l.pop(0)
	s += x
	if len(l) == 0:
		break
	l[0] -= s
	op -= 1
while op > 1:
	print(0)
	op -= 1


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
set_ = list(sorted(set(l)))
prev = 0
if k <= len(set_):
	for i in range(k):
		print(set_[i] - prev)
		prev = set_[i]
else:
	for i in range(len(set_)):
		print(set_[i] - prev)
		prev = set_[i]
	for _ in range(k - len(set_)):
		print(0)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
suma = 0
i = 0
cou = 0
if k <= n:
	while cou < k:
		if i < n:
			l[i] = l[i] - suma
			if l[i] != 0:
				print(l[i])
				cou += 1
				suma = suma + l[i]
				i += 1
			else:
				i += 1
		if i > n - 1 and cou < k:
			print(0)
			cou += 1
else:
	while cou < k:
		if i < n:
			l[i] = l[i] - suma
			if l[i] != 0:
				print(l[i])
				cou += 1
				suma = suma + l[i]
				i += 1
			else:
				i += 1
		if i > n - 1 and cou < k:
			print(0)
			cou += 1


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
count = 0
last = 0
ans = []
for i in range(len(a)):
	if last != a[i] and count < k:
		ans.append(a[i] - last)
		last = a[i]
for i in range(k):
	if len(ans) <= i:
		print(0)
	else:
		print(ans[i])


(a, b) = map(int, input().split())
arr = list(map(int, input().split()))
arr = list(set(arr))
arr.sort()
sum = 0
flag = 1
for i in range(b):
	if len(arr) > 0:
		print(arr[0])
		p = arr[0]
		sum = sum + arr[0]
		arr.remove(p)
		try:
			arr[0] = arr[0] - sum
		except IndexError:
			pass
	else:
		print(0)


nk = input()
(n, k) = [int(x) for x in nk.split()]
line = input()
ns = [int(x) for x in line.split()]
ns.sort()
i = 0
cnt = 1
cur = 0
tot = 0
while cnt <= k and i < n:
	cur = ns[i] - tot
	i += 1
	if cur == 0:
		continue
	else:
		print(cur)
		tot += cur
		cnt += 1
while cnt <= k:
	print(0)
	cnt += 1


(n, k) = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]
a.sort()
concentrate = 0
i = 0
operations = 0
while i < len(a) and operations < k:
	a[i] -= concentrate
	if a[i] != 0:
		print(a[i])
		concentrate += a[i]
		a[i] -= a[i]
		operations += 1
	i += 1
for d in range(k - operations):
	print(0)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
l = 0
c = []
for i in range(len(a)):
	a[i] -= l
	l += a[i]
	if a[i] > 0:
		c.append(a[i])
if len(c) < k:
	for i in range(len(c)):
		print(c[i])
	for i in range(k - len(c)):
		print(0)
else:
	for i in range(k):
		print(c[i])


(n, k) = [int(x) for x in input().split()]
L = [int(x) for x in input().split()]
L.sort()
D = {}
for i in L:
	if not i in D:
		D[i] = 1
S = list(D.keys())
S.sort()
start = None
for i in range(0, len(S)):
	if S[i] != 0:
		start = i
		break
s = 0
for i in range(0, k):
	if start == None or start >= len(S):
		print(0)
	elif S[start] <= s:
		print(0)
	else:
		print(S[start] - s)
		s += S[start] - s
		start += 1


(n, k) = map(int, input().split())
list = sorted(list(map(int, input().split())))
dele = 0
counter = 0
plus = 0
if n == 1:
	print(list[0])
	for _ in range(1, k):
		print(0)
else:
	for _ in range(k):
		print(list[counter] - dele)
		dele += list[counter] - dele
		counter += 1
		while counter < n - 1 and list[counter] == dele:
			counter += 1
			plus += 1
		if counter >= n - 1:
			break
	if _ != k - 1:
		print(list[counter] - dele)
	for __ in range(_ + 2, k):
		print(0)


(n, k) = list(map(int, input().split()))
p = list(map(int, input().split()))
p = list(set(p))
p.sort()
s = p[0]
la = 0
n = 1
print(p[0])
p.remove(p[0])
while p != list() and n < k:
	p[0] -= s
	s += p[0]
	print(p[0])
	p.remove(p[0])
	n += 1
if n < k:
	pam = k - n
	for y in range(pam):
		print(0)


s = input().split(' ')
n = int(s[0])
k = int(s[1])
a = input().split(' ')
a = map(int, a)
a = list(a)
b = list(set(a))
b = sorted(b)
minimo = b[0]
i = 0
j = 0
subtrair = 0
while i < k:
	if j < len(b):
		minimo = b[j]
		print(b[j] - subtrair)
		subtrair += minimo - subtrair
		j += 1
	else:
		break
	i += 1
if k - i > 0:
	print('0\n' * (k - i - 1), end='')
	print('0')


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
i = 0
cnt = 0
m = 0
while i < n and cnt < k:
	if l[i] - m > 0:
		print(l[i] - m)
		cnt = cnt + 1
		m = l[i]
	i = i + 1
while cnt < k:
	print(0)
	cnt = cnt + 1


(n, k) = map(int, input().split())
nums = list(map(int, input().split()))
nums.append(0)
nums = list(set(nums))
nums.sort()
i = 0
while i != k:
	if i >= len(nums) or i + 1 >= len(nums):
		print(0)
	else:
		print(nums[i + 1] - nums[i])
	i += 1


(n, k) = [int(x) for x in input().split()]
rt = 0
mas = sorted(set([int(x) for x in input().split()]))
if mas[0] == 0:
	mas.pop(0)
for item in mas:
	if k == 0:
		break
	print(item - rt)
	rt += item - rt
	k -= 1
for item in range(k):
	print(0)


from sys import stdin
from sys import stdout
(n, k) = map(int, stdin.readline().split())
a = list(map(int, stdin.readline().split()))
a = sorted(set(a))
j = 0
i = 0
res = []
while i < k and i < len(a):
	res.append(a[i] - j)
	j = a[i]
	i += 1
if k >= len(a):
	for i in range(k - len(a)):
		res.append('0')
for i in res:
	stdout.write(str(i) + '\n')


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
a = list(set(a))
a.sort()
sub = int(0)
for i in range(0, k):
	print(a[0])
	sub += a[0]
	a.pop(0)
	if a != []:
		while a[0] < sub:
			a.pop(0)
			if a == []:
				break
	if a != []:
		a[0] = a[0] - sub
	else:
		a.append(0)


a = [*map(int, input().split())]
n = [*map(int, input().split())]
s = sorted(set(n))
c = 0
min = 0
for i in range(a[1]):
	s[c] = s[c] - min
	if s[c] <= 0 and c < len(s) - 1:
		c += 1
		s[c] = s[c] - min
	r = s[c] if s[c] > 0 else 0
	min += r
	print(r)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l = list(set(l))
l.sort()
s = 0
for _ in range(k):
	if len(l) != 0:
		x = l[0] - s
		if x != 0:
			print(x)
		else:
			l = list(filter(l[0].__ne__, l))
			if len(l) != 0:
				print(l[0] - s)
				continue
			else:
				print('0')
				continue
		s += x
		l.remove(l[0])
	else:
		print('0')


def ans(arr):
	arr = sorted(list(set(arr)))
	print(arr[0])
	xx = min(len(arr), k)
	cnt = arr[0]
	for i in range(1, xx):
		if arr[i] - cnt > 0:
			print(arr[i] - cnt)
			cnt += arr[i] - cnt
		else:
			continue
	if k > xx:
		for _ in range(k - xx):
			print(0)
nk = list(map(int, input().strip().split()))
n = nk[0]
k = nk[1]
a = list(map(int, input().strip().split()))
ans(a)


(n, k) = map(int, input().split())
li = sorted(list(map(int, input().split())))
print(li[0])
i = 0
while i < k - 1:
	i += 1
	try:
		t = li[i] - li[i - 1]
		if t > 0:
			print(t)
		elif t == 0:
			k += 1
	except:
		print(0)


strInp = lambda : input().strip().split()
intInp = lambda : list(map(int, strInp()))
(n, m) = intInp()
arr = intInp()
newarr = []
for i in range(n):
	if arr[i] != 0:
		newarr.append(arr[i])
arr = list(set(arr))

def getAns(arr, total):
	if len(arr) == 0:
		return [0, total]
	ans = arr.pop() - total
	if ans != 0:
		total += ans
		return [ans, total]
	else:
		getAns(arr, total)
arr.sort(reverse=True)
total = 0
while m > 0:
	if len(arr) > 0:
		ans = getAns(arr, total)
		print(ans[0])
		total = ans[1]
	else:
		print(0)
	m -= 1


import sys
a = list(map(int, sys.stdin.read().split()))
n = a.pop(0)
k = a.pop(0)
a = iter(sorted(set(a)))
q = 0
for _ in [0] * k:
	x = next(a, q)
	print(x - q)
	q = x


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
s = 0
l = 0
for i in range(n):
	if l == k:
		break
	if a[i] - s <= 0:
		continue
	else:
		print(a[i] - s)
		s = a[i]
		l += 1
for i in range(l, k):
	print(0)


from sys import stdin, stdout
(n, k) = map(int, stdin.readline().split())
st = [0] + list(sorted(set(map(int, input().split()))))
stdout.write('\n'.join(['0' if i >= len(st) else str(st[i] - st[i - 1]) for i in range(1, k + 1)]))


(n, k) = map(int, input().split())
a = sorted(set(map(int, input().split())))
b = [0]
b.extend(a)
c = [x - y for (x, y) in zip(a, b)][:k]
for v in c:
	print(v)
for _ in range(k - len(c)):
	print(0)


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, OrderedDict
import math
import heapq

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
(n, k) = listIn()
a = listIn()
a = sorted(set(a))
l = len(a)
diff = [a[0]] + [0] * (l - 1)
for i in range(1, l):
	diff[i] = a[i] - a[i - 1]
if k > l:
	diff += [0] * (k - l)
for i in range(k):
	print(diff[i])


(n, k) = map(int, input().split())
arr = []
arr = list(map(int, input().split()))
arr = list(set(arr))
arr = sorted(arr)
l = len(arr)
for i in range(min(l, k)):
	if i == 0:
		print(arr[i])
	else:
		print(arr[i] - arr[i - 1])
if k > l:
	for i in range(k - l):
		print(0)


import math
(n, k) = map(int, input().split())
tmp = list(map(int, input().split()))
a = list(set(tmp))
a.sort()
(count, pos, len) = (0, 0, len(a))
while k > 0:
	if pos == len:
		print('0')
	else:
		print(a[pos] - count)
		count = a[pos]
		pos += 1
	k -= 1


R = lambda : map(int, input().split())
(n, k) = R()
a = iter(sorted(set(R())))
p = 0
while k:
	x = next(a, p)
	print(x - p)
	p = x
	k -= 1


from sys import stdin
from collections import deque
(_, n) = map(int, stdin.readline().split())
arr = map(int, stdin.readline().split())
deck = deque(sorted(set(arr)))
subtractor = 0
for _ in range(n):
	while True:
		try:
			m = deck.popleft()
			if m <= 0:
				continue
		except IndexError:
			print(0)
			break
		print(m - subtractor)
		subtractor += m - subtractor
		break


from sys import setcheckinterval, stdin
setcheckinterval(1000)
iin = lambda : int(stdin.readline())
lin = lambda : list(map(int, stdin.readline().split()))
(n, k) = lin()
a = lin()
a1 = []
for i in range(n):
	if a[i] > 0:
		a1.append(a[i])
a1.sort()
n = len(a1)
i = 0
sm = 0
ans = []
for _ in range(k):
	while i < n and a1[i] - sm <= 0:
		i += 1
	if i >= n:
		break
	a1[i] -= sm
	sm += a1[i]
	ans.append(a1[i])
	i += 1
l = len(ans)
if l < k:
	ans.extend([0] * (k - l))
for i in ans:
	print(i)


(n, k) = map(int, input().split())
st = [0] + list(sorted(set(map(int, input().split()))))
print('\n'.join(['0' if i >= len(st) else str(st[i] - st[i - 1]) for i in range(1, k + 1)]))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l = list(set(l))
l.sort()
ans = []
ans.append(l[0])
for i in range(1, len(l), 1):
	ans.append(l[i] - l[i - 1])
if k < len(ans):
	for i in range(k):
		print(ans[i])
else:
	for i in range(len(ans)):
		print(ans[i])
	for i in range(k - len(ans)):
		print(0)


from collections import deque
(n, k) = map(int, input().strip().split())
a = list(map(int, input().strip().split()))
a.sort()
d = deque()
for i in range(n):
	d.append(a[i])
s = 0
while k > 0:
	mn = 0
	if len(d) > 0:
		mn = d.popleft()
	while len(d) > 0:
		if d[0] != mn:
			break
		if d[0] == mn:
			d.popleft()
	s += mn
	if len(d) > 0:
		x = d[0]
	i = 0
	if len(d) > 0:
		while i < len(d):
			if d[i] == x:
				d[i] -= s
			elif d[i] != x:
				break
			i += 1
	print(mn)
	k -= 1


(a, b) = map(int, input().split())
l = sorted(list(set(list(map(int, input().split())))))
c = 0
v = 0
for i in range(b):
	try:
		m = l[0]
		p = m - c
		print(max(0, p))
		l.remove(m)
		c += p
	except:
		print(0)


(n, k) = map(int, input().split())
a = sorted(list(map(int, input().split())))
print(min(a))
count = 1
for i in range(1, n):
	if count == k:
		break
	if a[i] != a[i - 1]:
		print(a[i] - a[i - 1])
		count += 1
else:
	for i in range(count, k):
		print(0)


import sys
import heapq

class PriorityQueue:

	def __init__(self, heap=[]):
		self.heap = heapq.heapify(heap) if heap else []

	def __bool__(self):
		return bool(self.heap)

	def __str__(self):
		return str(self.heap)

	def __len__(self):
		return len(self.heap)

	def push(self, x):
		heapq.heappush(self.heap, x)

	def top(self):
		return self.heap[0]

	def pop(self):
		return heapq.heappop(self.heap)

	def pushpop(self, x):
		return heapq.heappushpop(self.heap, x)
input = sys.stdin.readline
(n, k) = map(int, input().split())
lis = list(map(int, input().split()))
subamt = 0
pq = PriorityQueue()
i = 0
for ele in lis:
	pq.push((ele, i))
	i += 1
while k > 0 and pq:
	(v, idx) = pq.pop()
	nv = v - subamt
	if nv > 0:
		print(nv)
		subamt += nv
		k -= 1
while k > 0:
	print(0)
	k -= 1


(n, k) = map(int, input().split())
s = sorted(list(set(map(int, input().split()))))
sum = 0
for i in range(min(len(s), k)):
	print(s[i] - sum)
	sum += s[i] - sum
for i in range(k - len(s)):
	print(0)


entrada1 = input()
n = int(entrada1.split()[0])
k = int(entrada1.split()[1])
arr_a = []
entrada2 = input().split()
i = 0
while i < len(entrada2):
	arr_a.append(int(entrada2[i]))
	i += 1
if n == 1:
	print(arr_a[0])
	i = 0
	while i < k - 1:
		print(0)
		i += 1
	exit()
arr_a.sort()
sas = 0
ytpbr = 0
i = 0
while i < n - 1:
	if ytpbr == 0 and arr_a[i] != 0:
		print(arr_a[i])
		ytpbr += 1
		if ytpbr == k:
			break
	if ytpbr > 0:
		if arr_a[i + 1] > arr_a[i]:
			print(abs(arr_a[i + 1] - arr_a[i]))
			sas += 1
	if sas + ytpbr == k:
		break
	i += 1
i = 0
while i < k - (sas + ytpbr):
	print(0)
	i += 1


(_, k) = map(int, input().split())
l = list(set(map(int, input().split())))
l.sort()
c = 0
for i in range(k):
	if i == 0:
		print(l[i])
	elif i >= len(l):
		print(0)
	elif l[i] - l[i - 1] < 0:
		print(0)
	else:
		print(l[i] - l[i - 1])


X = list(map(int, input().split()))
Numbers = list(map(int, input().split()))
Numbers = sorted(set(Numbers))
print(*[Numbers[i] - Numbers[i - 1] if i != 0 else Numbers[i] for i in range(min(len(Numbers), X[1]))], sep='\n')
print(*list('0' * (X[1] - len(Numbers))), sep='\n')


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
a.sort()
i = 0
sub = 0
f = 0
d = 0
for j in range(k):
	while i < n and (a[i] == 0 or f == a[i]):
		i += 1
	if i == n:
		break
	f = a[i]
	a[i] -= sub
	d += 1
	print(a[i])
	sub += a[i]
	a[i] = 0
	i += 1
for j in range(k - d):
	print('0')


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
s = 0
import heapq
heapq.heapify(A)
for i in range(k):
	flag = False
	while A:
		if A[0] - s <= 0:
			heapq.heappop(A)
		else:
			a = heapq.heappop(A)
			flag = True
			print(a - s)
			s += a - s
			break
	if not A and (not flag):
		print(0)


MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import *
(n, k) = I()
l = list(set(I()))
l.sort()
i = 0
j = 0
sub = 0
while i < len(l) and i < k:
	print(l[i] - sub)
	sub = l[i]
	i += 1
while i < k:
	print(0)
	i += 1


import sys
line = sys.stdin.readline().split()
n = int(line[0])
k = int(line[1])
a = sys.stdin.readline().split()
for i in range(0, n):
	a[i] = int(a[i])
a.sort()
s = 0
i = 0
j = 0
while j < k:
	while a[i] <= s and i < n - 1:
		i = i + 1
	if a[i] > s:
		print(a[i] - s)
		j = j + 1
		s = a[i]
	else:
		print(0)
		j = j + 1


import sys
(n, k) = map(int, input().split(' '))
arr = sorted(list(map(int, input().split(' '))))
s = 0
total = 0
for i in range(0, len(arr)):
	if arr[i] == 0:
		continue
	if arr[i] - s == 0:
		continue
	print(arr[i] - s)
	total = total + 1
	if total == k:
		break
	s = s + (arr[i] - s)
for i in range(total, k):
	print('0')


import sys, copy
(n, k) = map(int, sys.stdin.readline().split())
arr = list(map(int, sys.stdin.readline().split()))
arr.sort(reverse=True)
top = 0
while k > 0:
	if not arr:
		print(0)
		k -= 1
	else:
		if arr[-1] > top:
			print(arr[-1] - top)
			top = arr[-1]
			k -= 1
		arr.pop()


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
a.sort()
total_sub = 0
non_zero = 0
while non_zero < len(a) and a[non_zero] == 0:
	non_zero += 1
for _ in range(k):
	if non_zero == len(a):
		print(0)
		continue
	else:
		print(a[non_zero] - total_sub)
		total_sub += a[non_zero] - total_sub
		non_zero += 1
		while non_zero < len(a) and a[non_zero] - total_sub == 0:
			non_zero += 1


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
flag = 0
for i in range(n):
	if l[i] != 0:
		break
l = l[i:]
n = len(l)
i = 0
x = []
while i < n:
	if flag - l[i] != 0:
		x.append(l[i] - flag)
		flag += l[i] - flag
	i += 1
m = len(x)
if k <= m:
	for i in x[:k]:
		print(i)
else:
	for i in x:
		print(i)
	z = k - m
	for i in range(z):
		print('0')


(n, k) = [int(x) for x in input().split()]
a = sorted([int(x) for x in input().split()])
(c, p) = (0, 0)
for x in a:
	if x > p:
		c += 1
		print(x - p)
		p = x
		if c == k:
			break
while c < k:
	print(0)
	c += 1


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
b = [a[0]]
for i in range(n - 1):
	if a[i + 1] > a[i]:
		b.append(a[i + 1] - a[i])
c = len(b)
for i in range(k):
	if i < c:
		print(b[i])
	else:
		print(0)


entrada = input()
n = int(entrada.split()[0])
k = int(entrada.split()[1])
v = input()
v = list(map(int, v.split()))
v = sorted(v)
tot = 0
j = 0
printado = 0
for i in range(k):
	printado = v[min(j, n - 1)] - tot
	j += 1
	while printado == 0 and j < n:
		printado = v[min(j, n - 1)] - tot
		j += 1
	tot += printado
	if j > n:
		print(0)
	else:
		print(printado)


t = input().split(' ')
(n, k) = (int(t[0]), int(t[1]))
T = input().split(' ')
for i in range(n):
	T[i] = int(T[i])
T.sort()
d = 0
l = 0
j = 0
for i in range(k):
	while d < len(T) and T[d] <= j:
		d += 1
	if d < len(T):
		print(T[d] - j)
		j = T[d]
	else:
		print(0)


(j, k) = map(int, input().split(' '))
li = list(map(int, input().split(' ')))
li.insert(0, 0)
li = list(set(li))
li.sort()
l = max(j, k)
t = min(j, k)
i = 1
while i <= k:
	if i < len(li):
		print(li[i] - li[i - 1])
	else:
		print(0)
	i = i + 1


(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
a = list(set(a))
a.sort()
ans = [a[0]]
c = 1
sm = a[0]
for i in range(1, len(a)):
	ans += [a[i] - sm]
	sm += a[i] - sm
if len(a) >= k:
	for i in range(k):
		print(ans[i])
	print()
else:
	for i in range(len(a)):
		print(ans[i])
	res = k - len(a)
	for i in range(res):
		print(0)


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
from itertools import combinations
import sys
import math
MAX = sys.maxsize
MAXN = 10 ** 5 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b, x, y):
	return abs(a - x) + abs(b - y)

def numIN():
	return map(int, sys.stdin.readline().strip().split())

def charIN():
	return sys.stdin.readline().strip().split()
(n, k) = numIN()
l = list(numIN())
l.sort()
z = [l[i] - l[i - 1] for i in range(1, n)]
print(l[0])
cnt = 1
i = 0
while cnt != k and i != n - 1:
	if z[i] != 0:
		print(z[i])
		cnt += 1
	i += 1
if cnt < k:
	for _ in range(k - cnt):
		print(0)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
sys.setrecursionlimit(int(pow(10, 6)))
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(1):
	(n, k) = l()
	A = l()
	A.sort()
	x = 0
	i = 0
	while k > 0:
		if i >= n:
			print(0)
			k -= 1
		else:
			if A[i] - x == 0:
				i += 1
				continue
			print(A[i] - x)
			x += A[i] - x
			k -= 1
		i += 1


(n, k) = map(int, input().split())
l = [int(i) for i in input().split()]
cnt = 1
l.sort()
j = 0
for i in range(k):
	if j < n and l[j] - cnt >= 0:
		print(max(l[j] - cnt + 1, 0))
		cnt += max(l[j] - cnt + 1, 0)
	if j < n and l[j] - cnt < 0:
		while j < n and l[j] - cnt < 0:
			j += 1
	if j == n:
		for m in range(k - i - 1):
			print(0)
			break


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a = [0] + [i for i in sorted(set(a))]
for i in range(len(a) - 1):
	if i >= k:
		break
	print(a[i + 1] - a[i])
for i in range(k - len(a) + 1):
	print(0)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a = sorted(a)
print(a[0])
k -= 1
index = 0
while k > 0:
	index += 1
	if index < len(a):
		if a[index] - a[index - 1] == 0:
			continue
		print(a[index] - a[index - 1])
	else:
		print(0)
	k -= 1


x = input()
y = input()
x = x.split(' ')
inlist = y.split(' ')
(n, k) = (int(x[0]), int(x[1]))
for ii in range(n):
	inlist[ii] = int(inlist[ii])
inlist.sort()
index = 0
inlist = list(set(inlist))
for i in range(k):
	if i <= len(inlist) - 1:
		if i == 0:
			print(inlist[i])
		else:
			print(inlist[i] - inlist[i - 1])
	else:
		print(0)


(n, k) = map(int, input().split())
L = sorted(map(int, input().split()))
res = [L[0]]
for i in range(1, n):
	if L[i] != L[i - 1]:
		res.append(L[i] - L[i - 1])
l = len(res)
if k > l:
	res += [0] * (k - l)
for i in range(k):
	print(res[i])


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
last = 0
i = 0
while k > 0:
	k -= 1
	f = True
	while f:
		if i == len(a):
			f = False
		elif a[i] > last:
			f = False
		else:
			i += 1
	if i == len(a):
		print(0)
	else:
		print(a[i] - last)
		last = a[i]


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
i = 0
m = 0
while k:
	while a[i] <= m and i < n - 1:
		i += 1
	print(a[i] - m)
	m = a[i]
	k -= 1


ip = [int(i) for i in input().split()]
(n, k) = (ip[0], ip[1])
a = [int(i) for i in input().split()]
a = set(a)
a = list(a)
a.sort()
(n, s) = (len(a), 0)
for i in range(k):
	if i >= n:
		print(0)
		continue
	a[i] -= s
	s += a[i]
	print(a[i])


(n, m) = input().split(' ')
(n, m) = (int(n), int(m))
lst = input().split(' ')
lst = [int(x) for x in lst]
s = set(lst)
lst = list(s)
lst.sort()
i = 0
min_lst = 0
while m > 0:
	if lst:
		try:
			print(lst[i] - min_lst)
			min_lst += lst[i] - min_lst
			i += 1
		except:
			print(0)
	else:
		print(0)
	m -= 1


import math
import sys
import collections

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))
(n, k) = mi()
d = sorted(li())
for i in range(n - 1, 0, -1):
	d[i] -= d[i - 1]
i = j = 0
while i < k and j < n:
	if d[j] == 0:
		j += 1
		continue
	print(d[j])
	j += 1
	i += 1
while i < k:
	print(0)
	i += 1


(_, amount) = [int(s) for s in input().split()]
array = [int(s) for s in input().split()]
array = sorted(set(array))
diff = 0
if amount <= len(array):
	for i in range(amount):
		print(array[i] - diff)
		diff += array[i] - diff
else:
	for i in range(len(array)):
		print(array[i] - diff)
		diff += array[i] - diff
	for i in range(amount - len(array)):
		print(0)


def retarray():
	return list(map(int, input().split()))
(n, k) = retarray()
a = retarray()
a.sort()
(i, s, j) = (0, 0, 0)
while j < k:
	if a[i] - s <= 0:
		pass
	else:
		print(a[i] - s)
		s = a[i]
		j += 1
	i += 1
	if i >= n:
		break
while j < k:
	print(0)
	j += 1


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from heapq import *
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 10 ** 9 + 7

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	(n, k) = sep()
	a = list(set(lis()))
	a = sorted(a)
	n = len(a)
	curr = 0
	for i in range(min(n, k)):
		print(a[i] - curr)
		curr += a[i] - curr
	for i in range(0, k - n):
		print(0)
testcase(1)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()
curr_sum = 0
print(a[0])
curr_sum = a[0]
times = min(k - 1, len(a) - 1)
curr = 1
ti = 1
while times > 0:
	times -= 1
	if curr > n - 1:
		break
	a[curr] -= curr_sum
	if a[curr] == 0:
		times += 1
		curr += 1
		continue
	ti += 1
	print(a[curr])
	curr_sum += a[curr]
	curr += 1
if k - ti > 0:
	for i in range(k - ti):
		print(0)


(n, k) = map(int, input().split())
e = list(map(int, input().split()))
q = 0
e.sort()
for i in range(0, n):
	if e[i] > q:
		print(e[i] - q)
		q = e[i]
		k -= 1
		if k == 0:
			break
if k > 0:
	for a in range(0, k):
		print(0)


(n, k) = list(map(int, input().split()))
l1 = list(set(map(int, input().split())))
l1.sort()
for i in range(0, k):
	if i >= len(l1):
		print(0)
	elif i == 0:
		print(l1[i])
	else:
		print(l1[i] - l1[i - 1])


def main():
	(N, K) = list(map(int, input().split()))
	numbers = list(map(int, input().split()))
	numbers.sort(reverse=True)
	subst = 0
	for i in range(K):
		min_val = 0
		while min_val == 0:
			if len(numbers) == 0:
				print(0)
				break
			else:
				min_val = numbers.pop() - subst
				if min_val != 0:
					print(min_val)
					subst += min_val
					break
main()


(n, k) = list(map(int, input().split()))
a = sorted(list(set(map(int, input().split()))))
a.reverse()
x = 0
for i in range(k):
	if len(a) == 0:
		print(0)
	else:
		print(a[-1] - x)
		x = a[-1]
		a.pop()


from itertools import *
R = lambda : map(int, input().split())
(n, k) = R()
a = groupby(sorted(R()))
p = 0
while k:
	x = next(a, [p])[0]
	print(x - p)
	p = x
	k -= 1


def substraction(n, k, a):
	m = 0
	i = 0
	a = sorted(a)
	while i < k:
		if i > n - 1:
			print(0)
		elif i <= n - 1:
			if a[i] - m > 0:
				print(a[i] - m)
				m = a[i]
			else:
				k += 1
		i += 1
line_1 = list(map(int, input().split()))
n = line_1[0]
k = line_1[1]
a = list(map(int, input().split()))
substraction(n, k, a)


settings = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
curr = 0
factor = 0
b = False
for i in range(settings[1]):
	if b:
		print(0)
	else:
		while arr[curr] == 0:
			if curr + 1 >= len(arr):
				b = True
				break
			else:
				curr += 1
				if curr < len(arr):
					arr[curr] -= factor
		if curr < len(arr):
			print(arr[curr])
			factor += arr[curr]
			arr[curr] = 0


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
temp = arr[0]
arr2 = [arr[0]]
for i in range(1, n):
	arr2.append(arr[i] - arr[i - 1])
arr1 = []
for i in range(len(arr2)):
	if arr2[i] != 0:
		arr1.append(arr2[i])
ansarr = []
j = 0
for i in range(k):
	if j == len(arr1):
		ansarr.append(0)
	else:
		ansarr.append(arr1[j])
		j += 1
print(*ansarr)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l = list(set(l))
l.sort()
s = 0
for i in range(m):
	if i < len(l):
		print(l[i] - s)
		s = l[i]
	else:
		print(0)


(n, k) = map(int, input().split())
li = [int(x) for x in input().split()]
li = list(set(li))
li.sort()
s = 0
for i in range(0, len(li)):
	li[i] -= s
	s += li[i]
i = 0
while i < len(li) and k > 0:
	print(li[i])
	i += 1
	k -= 1
while k > 0:
	print(0)
	k -= 1


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l = list(set(l))
l.sort()
val = 0
for i in range(k):
	if i >= len(l):
		print(0)
	else:
		print(l[i] - val)
		val = l[i]


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
flag = 0
j = 0
for i in range(n):
	temp = a[i] - flag
	if temp > 0 and j < k:
		print(temp)
		flag += temp
		j += 1
for i in range(k - j):
	print(0)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
seta = sorted(list(set(a)))
t = 0
for i in range(min(k, len(seta))):
	print(seta[i] - t)
	t += seta[i] - t
for i in range(k - len(seta)):
	print(0)


(n, k) = map(int, input().split())
ls = list(set(map(int, input().split())))
ls.sort()
sum = ls[0]
for i in range(1, len(ls)):
	ls[i] -= sum
	sum += ls[i]
for i in range(k):
	try:
		print(ls[i])
	except:
		print(0)


tmp = input().split()
n = int(tmp[0])
k = int(tmp[1])
tmp = input().split()
nums = [int(i) for i in tmp]
nums = list(filter(lambda i: i != 0, nums))
nums.sort(reverse=True)
sum = 0
while k > 0:
	if len(nums) == 0:
		print('0')
		k = k - 1
		continue
	else:
		m = nums.pop()
		if m - sum == 0:
			continue
		else:
			print(m - sum)
			sum = m
			k = k - 1


(n, k) = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))
print(a[0])
minus = a[0]
i = 1
j = 1
while j < k:
	if i < n:
		if a[i] != a[i - 1] and a[i] - minus != 0:
			print(a[i] - minus)
			minus += a[i] - minus
			j += 1
	else:
		print(0)
		j += 1
	i += 1


(n, k) = map(int, input().split())
l = set(map(int, input().split()))
l = sorted(list(l))
c = 0
i = 0
while k != 0:
	if i < len(l) - 1:
		print(l[i])
		c += l[i]
		l[i] = 0
		l[i + 1] = l[i + 1] - c
		i += 1
	elif i == len(l) - 1:
		print(l[i])
		i += 1
	else:
		print(0)
	k -= 1


(n, k) = map(int, input().split())
v = list(set(list(map(int, input().split()))))
v.sort()
n = len(v)
t = x = m = 0
while t != k:
	if n > x:
		print(v[x] - m, end=' ')
		m = v[x]
	else:
		print(0, end=' ')
	x += 1
	t += 1


I = lambda : map(int, input().split())
(n, k) = map(int, input().split())
a = list(set(I()))
a.sort()
s = 0
ind = 0
for i in range(k):
	if a:
		try:
			print(a[ind] - s)
			s += a[ind] - s
			ind += 1
		except:
			print(0)
	else:
		print(0)


(n, k) = [int(x) for x in input().split(' ')]
a = [int(x) for x in input().split(' ')]
a.sort()
i = 0
while a[i] == 0:
	i += 1
t = 0
start = i
for _ in range(i, i + k):
	if start == n:
		print(0)
	else:
		while start < n and a[start] - t <= 0:
			start += 1
		if start == n:
			print(0)
		else:
			print(a[start] - t)
			t += a[start] - t
			start += 1


def solve():
	(n, k) = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()] + [0]
	arr.sort()
	diffs = [x - y for (x, y) in zip(arr[1:], arr[:-1])]
	idx = 0
	for _ in range(k):
		while idx < len(diffs) and diffs[idx] == 0:
			idx += 1
		if idx < len(diffs):
			print(diffs[idx])
			idx += 1
		else:
			print(0)
solve()


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
res = 0
l = list(set(l))
l.sort()
t = len(l)
l.insert(0, 0)
if k < t:
	for i in range(1, k + 1):
		print(l[i] - l[i - 1])
else:
	for i in range(1, t + 1):
		print(l[i] - l[i - 1])
	for j in range(k - t):
		print(0)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)
b = set(a)
b = sorted(b)
l = len(b)
c = []
z = 0
c.append(b[0])
for i in range(l - 1):
	if i >= 0:
		c.append(abs(b[i] - b[i + 1]))
l1 = len(c)
for i in range(k):
	if i < l1:
		print(c[i])
	else:
		print(z)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a = list(set(a))
a.sort()
lazy = 0
i = 0
while k > 0:
	if i == len(a):
		print(0)
		k -= 1
		continue
	print(a[i] - lazy)
	lazy = a[i]
	i += 1
	k -= 1


def main():
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	p = 0
	sum = 0
	arr.sort()
	for i in range(k):
		while p < n and arr[p] - sum == 0:
			p += 1
		if p < n:
			print(arr[p] - sum)
			sum = arr[p]
		else:
			print(0)
main()


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a = list(set(a))
a.sort()
n = len(a)
print(a[0])
i = 1
for _ in range(min(n, k) - 1):
	print(a[i] - a[i - 1])
	i += 1
if k > n:
	for i in range(k - n):
		print(0)


(N, K) = map(int, input().split())
aN = list(map(int, input().split()))
aN = sorted(set(aN))
aN.extend([0] * (K - len(aN)))
print(aN[0])
for i in range(1, K):
	if aN[i] != 0:
		print(aN[i] - aN[i - 1])
	else:
		print(0)


(n, k) = map(int, input().split())
a = [*map(int, input().split())]
a.sort()
balance = 0
i = 0
while k:
	if i >= n:
		print(0)
		k -= 1
	while i < n:
		if a[i] - balance > 0:
			print(a[i] - balance)
			balance += a[i] - balance
			i += 1
			k -= 1
			break
		i += 1


(n, k) = list(map(int, input().strip().split()))
a = list(map(int, input().strip().split()))
b = sorted(list(set(a)))
c = 0
for i in range(k):
	if i < len(b):
		print(b[i] - c)
		c = b[i]
	else:
		print(0)


(n, k) = map(int, input().split())
numbers = map(int, input().split())
(res, numbers) = ([], [0] + sorted(list(set(numbers))))
for i in range(min(len(numbers) - 1, k)):
	print(numbers[i + 1] - numbers[i])
for _ in range(k - len(numbers) + 1):
	print(0)


inp = input()
(n, k) = inp.split()
n = int(n)
k = int(k)
nums = input()
nums = nums.split()
numeros = []
for i in range(n):
	numeros.append(int(nums[i]))
numeros = sorted(numeros)
i = 0
discount = 0
for j in range(k):
	while i != n - 1 and numeros[i] == discount:
		i += 1
	print(numeros[i] - discount)
	discount = numeros[i]


def mi():
	return map(int, input().split(' '))
(n, k) = mi()
li = list(set(mi()))
li.sort()
count = 0
lisize = len(li)
for i in range(k):
	if i < lisize:
		if li[i] - count >= 0:
			print(li[i] - count)
		else:
			print(0)
		if i > 0:
			count += li[i] - li[i - 1]
		else:
			count = li[0]
	else:
		print(0)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
kol = 1
b = []
b.append(a[0])
for i in range(1, len(a)):
	if a[i] > a[i - 1]:
		kol += 1
		b.append(a[i])
if kol >= k:
	s = 0
	for i in range(k):
		print(b[0] - s)
		s += b[0] - s
		del b[0]
else:
	s = 0
	for i in range(kol):
		print(b[0] - s)
		s += b[0] - s
		del b[0]
	for i in range(k - kol):
		print(0)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l = list(set(l))
l.sort()
ind = 0
prev = 0
n = len(l)
q = 0
for i in range(k):
	while ind < n:
		if l[ind] != 0:
			break
		ind += 1
	if ind >= n:
		print('0')
	else:
		q = l[ind]
		l[ind] -= q
		print(q - prev)
		prev += q - prev


(a, b) = map(int, input().split())
c = sorted(set(map(int, input().split())))
i = 0
k = 0
while i < len(c) and b:
	print(c[i] - k)
	k += c[i] - k
	i += 1
	b -= 1
while b:
	print(0)
	b -= 1


import sys
import math
import bisect
import itertools
import random

def main():
	(n, m) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(sorted(set(A)))
	for i in range(len(B) - 1, -1, -1):
		if i:
			B[i] -= B[i - 1]
	if len(B) > m:
		B = B[0:m]
	while len(B) < m:
		B.append(0)
	print('\n'.join(list((str(a) for a in B))))
main()


(n, k) = map(int, input().split())
lis = list(map(int, input().split()))
kk = sorted(set(lis))
prev = 0
for i in range(k):
	if i >= len(kk):
		print(0)
		continue
	else:
		print(kk[i] - prev)
		prev = kk[i]


(n, k) = map(int, input().split())
l = [int(s) for s in input().split()]
re = list(set(l))
re.sort()
re = re[:k]
ini = 0
fl = 0
for i in range(len(re)):
	print(re[i] - ini)
	ini = re[i]
	if k > len(re):
		fl = 1
if fl == 1:
	for i in range(k - len(re)):
		print(0)


(n, k) = map(int, input().split())
arr = list(sorted(set(map(int, input().split()))))
ans = list()
ans.append(arr[0])
for i in range(min(k - 1, len(arr) - 1)):
	ans.append(arr[i + 1] - arr[i])
ans.extend([0] * (k - len(ans)))
print('\n'.join(map(str, ans)))


(n, k) = map(int, input().split())
a = [int(i) for i in input().split() if int(i) > 0]
a = sorted(list(set(a)))
x = a[0]
cur = 0
for i in range(k):
	print(x)
	try:
		x = a[i + 1] - (x + cur)
		cur = a[i]
	except:
		x = 0


(n, k) = map(int, input().split())
lis = list(map(int, input().strip().split()))
lis.sort(reverse=True)
mi = 0
if lis != []:
	mi = lis.pop()
su = mi
print(mi)
for i in range(k - 1):
	if lis == []:
		print(0)
		continue
	mi = lis[-1] - su
	while mi == 0:
		lis.pop()
		if lis == []:
			break
		mi = lis[-1] - su
	if lis == []:
		print(0)
		continue
	su += mi
	lis.pop()
	print(mi)


from collections import deque
(n, k) = [int(p) for p in input().split()]
arr = sorted([int(p) for p in input().split()])
arr = deque(arr)
curr = 0
while arr and k > 0:
	p = arr.popleft()
	if p == curr:
		continue
	print(p - curr)
	curr = p
	k -= 1
while k:
	print(0)
	k -= 1


(n, k) = tuple(map(int, input().split()))
array = sorted(list(dict.fromkeys(map(int, input().split()), 1)))
size = len(array)
i = 0
while i < k:
	if i < size:
		if i > 0:
			print(array[i] - array[i - 1])
		else:
			print(array[i])
	else:
		print(0)
	i += 1


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
ans = []
cur = 0
for a in arr:
	if a > cur:
		ans.append(a - cur)
		cur += a - cur
if k > len(ans):
	ans += [0] * (k - len(ans))
print('\n'.join(map(str, ans[:k])))


nk = [int(x) for x in input().split(' ')]
arr = [int(x) for x in input().split(' ')]
arr.sort()
arr.reverse()
subtract = 0
while len(arr) > 0 and nk[-1]:
	while len(arr) > 0 and arr[-1] <= subtract:
		arr.pop()
	if len(arr) == 0:
		break
	temp = arr.pop() - subtract
	subtract += temp
	print(temp)
	nk[-1] -= 1
for i in range(nk[-1]):
	print(0)


(n, k) = map(int, input().split())
mas = list(map(int, input().split()))
mas.sort()
(t, h) = (0, 0)
for i in range(n):
	if h >= k:
		break
	q = mas[i] - t
	if q != 0:
		print(q)
		t += q
		h += 1
if h < k:
	for i in range(k - h):
		print(0)


(n, k) = map(int, input().split())
seq = sorted(set(map(int, input().split())))
last = 0
for i in range(k):
	try:
		print(seq[i] - last)
		last = seq[i]
	except IndexError:
		print(0)


R = lambda : list(map(int, input().split()))
(a, b) = R()
L = list(set(R()))
if L[0] == 0:
	L.pop(0)
L.sort()
su = 0
i = 0
while b > 0:
	print(L[i] - su)
	su += L[i] - su
	if i == len(L) - 1:
		su = L[i]
	else:
		i += 1
	b -= 1


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a = list(set(a))
a.sort()
i = s = 0
n = len(a)
while i < n and a[i] == 0:
	i += 1
while i < n - 1 and k > 0:
	if a[i] != 0:
		print(a[i])
		s = s + a[i]
		a[i + 1] -= s
		k -= 1
	i += 1
if k > 0:
	print(a[n - 1])
	k -= 1
while k > 0:
	print(0)
	k -= 1


from sys import stdin, stdout
import cProfile, math
from collections import Counter
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10000000)

class Operation:

	def __init__(self, name, function, function_on_equal, neutral_value=0):
		self.name = name
		self.f = function
		self.f_on_equal = function_on_equal

def add_multiple(x, count):
	return x * count

def min_multiple(x, count):
	return x

def max_multiple(x, count):
	return x
sum_operation = Operation('sum', sum, add_multiple, 0)
min_operation = Operation('min', min, min_multiple, 1000000000.0)
max_operation = Operation('max', max, max_multiple, -1000000000.0)

class SegmentTree:

	def __init__(self, array, operations=[sum_operation, min_operation, max_operation]):
		self.array = array
		if type(operations) != list:
			raise TypeError('operations must be a list')
		self.operations = {}
		for op in operations:
			self.operations[op.name] = op
		self.root = SegmentTreeNode(0, len(array) - 1, self)

	def query(self, start, end, operation_name):
		if self.operations.get(operation_name) == None:
			raise Exception('This operation is not available')
		return self.root._query(start, end, self.operations[operation_name])

	def summary(self):
		return self.root.values

	def update(self, position, value):
		self.root._update(position, value)

	def update_range(self, start, end, value):
		self.root._update_range(start, end, value)

	def __repr__(self):
		return self.root.__repr__()

class SegmentTreeNode:

	def __init__(self, start, end, segment_tree):
		self.range = (start, end)
		self.parent_tree = segment_tree
		self.range_value = None
		self.values = {}
		self.left = None
		self.right = None
		if start == end:
			self._sync()
			return
		self.left = SegmentTreeNode(start, start + (end - start) // 2, segment_tree)
		self.right = SegmentTreeNode(start + (end - start) // 2 + 1, end, segment_tree)
		self._sync()

	def _query(self, start, end, operation):
		if end < self.range[0] or start > self.range[1]:
			return None
		if start <= self.range[0] and self.range[1] <= end:
			return self.values[operation.name]
		self._push()
		left_res = self.left._query(start, end, operation) if self.left else None
		right_res = self.right._query(start, end, operation) if self.right else None
		if left_res is None:
			return right_res
		if right_res is None:
			return left_res
		return operation.f([left_res, right_res])

	def _update(self, position, value):
		if position < self.range[0] or position > self.range[1]:
			return
		if position == self.range[0] and self.range[1] == position:
			self.parent_tree.array[position] = value
			self._sync()
			return
		self._push()
		self.left._update(position, value)
		self.right._update(position, value)
		self._sync()

	def _update_range(self, start, end, value):
		if end < self.range[0] or start > self.range[1]:
			return
		if start <= self.range[0] and self.range[1] <= end:
			self.range_value = value
			self._sync()
			return
		self._push()
		self.left._update_range(start, end, value)
		self.right._update_range(start, end, value)
		self._sync()

	def _sync(self):
		if self.range[0] == self.range[1]:
			for op in self.parent_tree.operations.values():
				current_value = self.parent_tree.array[self.range[0]]
				if self.range_value is not None:
					current_value = self.range_value
				self.values[op.name] = op.f([current_value])
		else:
			for op in self.parent_tree.operations.values():
				result = op.f([self.left.values[op.name], self.right.values[op.name]])
				if self.range_value is not None:
					bound_length = self.range[1] - self.range[0] + 1
					result = op.f_on_equal(self.range_value, bound_length)
				self.values[op.name] = result

	def _push(self):
		if self.range_value is None:
			return
		if self.left:
			self.left.range_value = self.range_value
			self.right.range_value = self.range_value
			self.left._sync()
			self.right._sync()
			self.range_value = None

	def __repr__(self):
		ans = '({}, {}): {}\n'.format(self.range[0], self.range[1], self.values)
		if self.left:
			ans += self.left.__repr__()
		if self.right:
			ans += self.right.__repr__()
		return ans

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def primeFactors(n):
	factors = dict()
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		while n % i == 0:
			if i in factors:
				factors[i] += 1
			else:
				factors[i] = 1
			n = n // i
	if n > 2:
		factors[n] = 1
	return factors

def isprime(n):
	if n < 4:
		return True
	if n % 2 == 0:
		return False
	if n % 3 == 0:
		return False
	i = 5
	w = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += w
		w = 6 - w
	return True

def test_print(*args):
	if testingMode:
		print(args)

def display_list(list1, sep=' '):
	stdout.write(sep.join(map(str, list1)) + '\n')

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))
memory = dict()

def clear_cache():
	global memory
	memory = dict()

def cached_fn(fn, *args):
	global memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result
TestCases = False
testingMode = False
optimiseForReccursion = False
counts = 0

def main():
	(n, k) = get_tuple()
	li = get_list()
	li.sort()
	sub = 0
	index = 0
	for i in range(k):
		if len(li) > index:
			print(li[index] - sub)
			sub += li[index] - sub
			while li[index] - sub == 0:
				index += 1
				if len(li) <= index:
					break
		else:
			print(0)
if TestCases:
	for _ in range(get_int()):
		cProfile.run('main()') if testingMode else main()
else:
	(cProfile.run('main()') if testingMode else main()) if not optimiseForReccursion else threading.Thread(target=main).start()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
cur = 0
idx = 0
for i in range(k):
	ans = 0
	while idx < n:
		ans = a[idx] - cur
		idx += 1
		if ans != 0:
			break
	print(ans)
	cur += ans


(n, m) = map(int, input().split())
l = list(set(map(int, input().split())))
l.sort()
ans = l[0]
s = [ans]
for i in range(1, len(l)):
	p = ans
	ans = l[i] - ans
	s.append(ans)
	ans += p
a = len(s)
if a >= m:
	for i in range(m):
		print(s[i])
else:
	for i in s:
		print(i)
	for i in range(m - a):
		print(0)


def solve(k, a):
	a = sorted(a, reverse=True)
	substracted = 0
	pos = len(a) - 1
	for _ in range(k):
		if pos == -1:
			yield 0
			continue
		yield (a[pos] - substracted)
		substracted = a[pos]
		while pos > 0 and a[pos] == substracted:
			pos -= 1
	return a

def main():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	res = list(solve(k, a))
	print(*res, sep='\n')
main()


import sys
(n, k) = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
cnt = 0
prev = 0
for i in range(len(A)):
	ans = A[i] - prev
	if ans != 0:
		print(ans)
		prev = A[i]
		cnt += 1
	if cnt == k:
		break
for _ in range(k - cnt):
	print(0)


arr = [int(x) for x in input().split()]
n = arr[0]
k = arr[1]
nums = [int(x) for x in input().split()]
subsum = 0
nums.sort()
nums = list(dict.fromkeys(nums))
i = 0
for c in range(k):
	print(nums[i])
	subsum += nums[i]
	if i < len(nums) - 1:
		i += 1
	if nums[i] > 0:
		nums[i] -= subsum
		if nums[i] < 0:
			nums[i] = 0


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
ps = 0
count = 0
for i in range(n):
	if count < k:
		if a[i] - ps > 0:
			print(a[i] - ps)
			count += 1
		ps = a[i]
while count < k:
	print(0)
	count += 1


(n, k) = tuple(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
sm = 0
for a in arr:
	if a - sm != 0:
		print(a - sm)
		sm += a - sm
		k -= 1
	if k == 0:
		break
while k > 0:
	print(0)
	k -= 1


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
for i in range(n - 1, 0, -1):
	l[i] -= l[i - 1]
i = 0
while i < n and k > 0:
	if l[i] == 0:
		flag = 0
	else:
		print(l[i])
		k -= 1
	i += 1
for i in range(k):
	print(0)


(n, k) = map(int, input().split())
l1 = list(set([int(x) for x in input().split()]))
l1.sort(reverse=True)
temp = 0
pop = 1
for i in range(k):
	if len(l1):
		print(l1[-1] - temp)
		temp += l1.pop() - temp
	else:
		print(0)


from itertools import *
R = lambda : map(int, input().split())
(n, k) = R()
a = [x for (x, _) in groupby(sorted(R()))]
a = a[:k] + [a[-1]] * (k - len(a))
print(*(y - x for (x, y) in zip([0] + a, a)))


(n, k) = map(int, input().split())
a = set(map(int, input().split()))
l = list(a)
l.sort()
n = len(l)
sub = 0
for i in range(min(k, n)):
	print('{}'.format(l[i] - sub))
	sub = l[i]
for i in range(min(k, n), k):
	print('0')


(n, k) = map(int, input().split())
(j, check, sum) = (0, 0, 0)
a = [int(s) for s in input().split()]
a.sort()
while k:
	k -= 1
	check = 0
	while j < n and a[j] - sum <= 0:
		j += 1
	if j == n:
		print(0)
	else:
		print(a[j] - sum)
		sum += a[j] - sum
		j += 1


(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
b = set(a)
c = list(b)
c.sort()
lc = len(c)
ptr = 0
s = 0
while k != 0:
	if ptr == lc:
		print(0)
	else:
		print(c[ptr] - s)
		s += c[ptr] - s
		ptr += 1
	k -= 1


(n, k) = map(int, input().split())
b = list(sorted(set(map(int, input().split()))))
x = 0
for i in range(k):
	if i == len(b):
		break
	print(b[i] - x)
	x = b[i]
if k > len(b):
	z = [0] * (k - len(b))
	print(*z, sep='\n')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def main():
	(n, k) = LI()
	c = collections.Counter(LI())
	a = sorted(c.keys())
	t = 0
	r = []
	for b in a:
		r.append(b - t)
		t = b
	if len(r) < k:
		r += [0] * (k - len(r))
	return '\n'.join(map(str, r[:k]))
print(main())


(n, k) = [int(i) for i in input().split()]
lst = [int(i) for i in input().split()]
lst.sort()
(cur, ind) = (0, 0)
for i in range(k):
	result = 0
	while ind < n:
		result = lst[ind] - cur
		ind += 1
		if result != 0:
			break
	print(result)
	cur += result


(n, k) = list(map(int, input().split(' ')))
arr = list(map(int, input().split(' ')))
arr.sort()
i = 0
s = 0
while k > 0:
	while i < n and arr[i] <= s:
		i += 1
	if i >= n:
		print(0)
	else:
		print(arr[i] - s)
		s += arr[i] - s
	k -= 1


from sys import exit

def rint():
	return int(input())

def rints():
	return [int(s) for s in input().split(' ')]
(n, k) = rints()
nums = sorted(rints())
deficit = 0
steps = 0
for num in nums:
	if steps == k:
		break
	if num <= deficit:
		continue
	steps += 1
	print(num - deficit)
	deficit += num - deficit
for i in range(steps, k):
	print(0)


def solve(n, k, A):
	A = sorted(A)
	running = 0
	ptr = 0
	res = []
	for _ in range(k):
		while ptr < n and A[ptr] <= running:
			ptr += 1
		if ptr >= n:
			res.append(0)
			continue
		res.append(A[ptr] - running)
		running += A[ptr] - running
	return res
(n, k) = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
res = solve(n, k, A)
for a in res:
	print(a)


3
(n, k) = map(int, input().split())
values = sorted(set(map(int, input().split())))
prev = 0
distinct = min(len(values), k)
for i in range(distinct):
	print(values[i] - prev)
	prev = values[i]
for i in range(k - distinct):
	print(0)


(n, k) = map(int, input().split())
A = set(map(int, input().split()))
A.add(0)
c = 0
c1 = 0
A = list(A)
A.sort()
while c1 < k:
	if c == len(A) - 1:
		print(0)
	else:
		print(A[c + 1] - A[c])
		c += 1
	c1 += 1


(n, k) = [int(i) for i in input().split()]
num = [int(i) for i in input().split()]
num.sort()
s = 0
for v in num:
	mv = v - s
	if mv > 0:
		print(mv)
		s += mv
		k -= 1
	if k == 0:
		break
for i in range(k):
	print(0)


import math
import bisect
import itertools
import sys
I = lambda : sys.stdin.readline()
mod = 10 ** 9 + 7

def mindiff(a):
	b = a[:]
	b.sort()
	m = 10000000000
	for i in range(len(b) - 1):
		if b[i + 1] - b[i] < m:
			m = b[i + 1] - b[i]
	return m

def lcm(a, b):
	return a * b // math.gcd(a, b)

def merge(a, b):
	i = 0
	j = 0
	c = 0
	ans = []
	while i < len(a) and j < len(b):
		if a[i] < b[j]:
			ans.append(a[i])
			i += 1
		else:
			ans.append(b[j])
			c += len(a) - i
			j += 1
	ans += a[i:]
	ans += b[j:]
	return (ans, c)

def mergesort(a):
	if len(a) == 1:
		return (a, 0)
	mid = len(a) // 2
	(left, left_inversion) = mergesort(a[:mid])
	(right, right_inversion) = mergesort(a[mid:])
	(m, c) = merge(left, right)
	c += left_inversion + right_inversion
	return (m, c)

def is_prime(num):
	if num == 2:
		return True
	if num == 3:
		return True
	if num % 2 == 0:
		return False
	if num % 3 == 0:
		return False
	t = 5
	a = 2
	while t <= int(math.sqrt(num)):
		if num % t == 0:
			return False
		t += a
		a = 6 - a
	return True

def ceil(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1

def binsearch(arr, b, low, high):
	if low == high:
		return low
	if arr[math.ceil((low + high) / 2)] < b:
		return binsearch(arr, b, low, math.ceil((low + high) / 2) - 1)
	else:
		return binsearch(arr, b, math.ceil((low + high) / 2), high)

def ncr1(n, r):
	s = 1
	for i in range(min(n - r, r)):
		s *= n - i
		s %= mod
		s *= pow(i + 1, mod - 2, mod)
		s %= mod
	return s

def calc(n, m, r):
	s = 0
	for i in range(0, r + 1, 2):
		s += ncr1(n, i) * ncr1(m, i)
		s %= mod
	return s
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a = list(set(a))
a.append(0)
a.sort()
for i in range(k):
	if i + 1 < len(a):
		print(a[i + 1] - a[i])
for j in range(max(k - len(a) + 1, 0)):
	print(0)


def main(n, k, arr):
	arr = list(set(arr))
	arr.sort()
	length = len(arr)
	total_val_to_sub = 0
	for i in range(k):
		if i < length:
			print(arr[i] - total_val_to_sub)
			total_val_to_sub += arr[i] - total_val_to_sub
		else:
			print(0)
(a, b) = list(map(int, input().split()))
arr = list(map(int, input().split()))
main(a, b, arr)


MAX = 1000000000.0 + 10
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
for i in range(1, len(a)):
	if a[i - 1] == a[i]:
		a[i - 1] = MAX
a.sort()
if MAX in a:
	a = a[:-a.count(MAX)]
s = 0
for i in range(k):
	if len(a) > i:
		ans = a[i] - s
		print(ans)
		s += ans
	else:
		print(0)


from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import sys
input = sys.stdin.readline
import heapq
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ka = []
for i in l:
	if i != 0:
		ka.append(i)
z = ka.copy()
heapq.heapify(z)
prev = 0
while z != [] and k != 0:
	x = heapq.heappop(z)
	if x - prev != 0:
		print(x - prev)
		k -= 1
		prev += x - prev
while k != 0:
	print(0)
	k -= 1


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr = list(set(arr))
arr.sort()
prev = 0
for i in range(k):
	if i < len(arr):
		print(arr[i] - prev)
		prev = arr[i]
	else:
		print(0)


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
tS = 0
i = 0
while i < k:
	if A == []:
		print(0, end=' ')
		i += 1
	else:
		A[-1] -= tS
		if A[-1] > 0:
			print(A[-1], end=' ')
			tS += A[-1]
			A.pop()
			i += 1
		else:
			A.pop()


import sys
from collections import defaultdict as dd
from collections import deque
from fractions import Fraction as f

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
import copy
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def li():
	return [int(x) for x in input().split()]

def fi():
	return int(input())

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def bo(i):
	return ord(i) - ord('a')
from copy import *
from bisect import *
from itertools import permutations
t = 1
while t > 0:
	t -= 1
	(n, k) = mi()
	a = li()
	c = 0
	a.sort()
	j = 0
	for i in range(k):
		if j >= n:
			print(0)
			continue
		while j < n and a[j] == c:
			j += 1
		if j == n:
			print(0)
			continue
		print(max(0, a[j] - c))
		c += a[j] - c


def minimum_subtract(n, k, seq):
	new_unique = sorted(list(set(seq)))
	times = 0
	pointer_non_zero = 0
	previous = 0
	while times < k:
		if pointer_non_zero >= len(new_unique):
			print(0)
		else:
			print(new_unique[pointer_non_zero] - previous)
			previous += new_unique[pointer_non_zero] - previous
		pointer_non_zero += 1
		times += 1
(n, k) = list(map(int, input().split()))
seq = list(map(int, input().split()))
minimum_subtract(n, k, seq)


(n, k) = map(int, input().split())
a = sorted(list(map(int, input().split())))
s = 0
i = 0
while k != 0:
	if i >= n:
		k -= 1
		print(0)
	elif a[i] - s == 0:
		i += 1
	else:
		print(a[i] - s)
		s = a[i]
		i += 1
		k -= 1


s = ''

def func(l1, k):
	l1.sort()
	st = ''
	s = 0
	n = len(l1)
	ma = l1[n - 1]
	p = 0
	i = 0
	while i < n and p < k:
		if l1[i] - s < 0:
			i += 1
			break
		if l1[i] - s == 0:
			i += 1
			continue
		st += str(l1[i] - s) + '\n'
		s += l1[i] - s
		i += 1
		p += 1
	if l1[n - 1] - s == 0 and p < k:
		st += '0\n' * (k - p)
	return st
(n, k) = map(int, input().split())
l1 = [int(y) for y in input().split()]
print(func(l1, k))


(n, k) = map(int, input().split())
a = map(int, input().split())
s = sorted(a)
i = 0
last = 0
for _ in range(k):
	while i < n and s[i] == last:
		last = s[i]
		i += 1
	if i == n:
		print(0)
	else:
		print(s[i] - last)
		last = s[i]
		i += 1


from math import inf
(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
a.sort()
s = 0
j = 0
for i in range(k):
	f = False
	while j < n and a[j] - s == 0:
		j += 1
	if j == n:
		print(0)
	else:
		a[j] -= s
		print(a[j])
		s += a[j]
		a[j] = 0
		j += 1


(n, k) = input().split()
n = int(n)
k = int(k)
a = [int(x) for x in input().split()]
b = list(set(a))
if len(a) > n:
	print('Out of Range')
	exit()
try:
	b.remove(0)
except:
	b.sort()
b.sort()
c = [0]
c += b
for i in range(k):
	if i <= len(b) - 1:
		print(c[i + 1] - c[i])
	else:
		print('0')


(n, k) = map(int, input().split())
c = list(map(int, input().split()))
l = sorted(list(set(c)))
s = [l[0]]
for i in range(1, len(l)):
	s.append(l[i] - l[i - 1])
if k > len(s):
	for i in range(k - len(s)):
		s.append(0)
for i in range(k):
	print(s[i])


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(list(set(A)))
rec = 0
i = 0
n = len(A)
while i < n:
	if i == k:
		break
	print(A[i] - rec)
	rec += A[i] - rec
	i += 1
while i < k:
	print(0)
	i += 1


[a, b] = [int(x) for x in input().split(' ')]
c = [int(x) for x in input().split(' ')]
c.sort()
index = -1
for i in c:
	if i != 0:
		index = index + 1
		break
	else:
		index = index + 1
prev = 0
for i in range(b):
	if index >= a:
		print('0')
	else:
		r = c[index] - prev
		print(r)
		prev = c[index]
		while index < a and c[index] == prev:
			index = index + 1


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
C = set(A)
C = list(C)
C.sort()
B = [0 for i in range(len(C))]
B[0] = C[0]
for i in range(1, len(C)):
	B[i] = C[i] - C[i - 1]
i = 0
while k > 0 and i < len(B):
	print(B[i])
	k -= 1
	i += 1
while k > 0:
	print(0)
	k -= 1


(n, m) = map(int, input().split())
mat = sorted(list(map(int, input().split())))
len_mat = len(mat) - 1
(step, i) = (0, -1)
while m > 0:
	if i < len_mat:
		i += 1
		q = mat[i]
		if q - step < 1:
			continue
		print(q - step)
		step = q
	else:
		print(0)
	m -= 1


l1 = input().split()
l2 = input().split()
l1 = [int(i) for i in l1]
l2 = [int(i) for i in l2]
l = 0
v = 0
l2.sort()
for i in range(l1[1]):
	while l != l1[0] - 1 and l2[l] == v:
		l = l + 1
	print(l2[l] - v)
	v = l2[l]


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
s = a[0]
i = 0
c = 0
if a[-1] == 0:
	for i in range(k):
		print(0)
else:
	while c < k:
		if i < n and a[i] != 0:
			print(a[i])
			c += 1
		if i < n - 1:
			a[i + 1] = a[i + 1] - s
			s += a[i + 1]
		elif i > n - 1:
			print(0)
			c += 1
		i += 1


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x) + '\n')
(n, k) = get_int_list()
lst = list(sorted(set(get_int_list())))
res = [0] * k
prev = 0
i = j = 0
while i < len(lst) and k > 0:
	res[j] = lst[i] - prev
	prev = lst[i]
	i += 1
	j += 1
	k -= 1
print(*res)


import sys
import heapq

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
(n, k) = read_int_line()
a = read_int_line()
heapq.heapify(a)
b = 0
ptr = 0
p = 0
while ptr < n and p < k:
	x = heapq.heappop(a)
	ptr += 1
	if x + b == 0:
		continue
	x = x + b
	b = b - x
	p += 1
	print(x)
if p < k:
	for i in range(k - p):
		print(0)


(n, k) = map(int, input().split(' '))
a = iter(sorted(set(map(int, input().split(' ')))))
r = 0
while k > 0:
	x = next(a, r)
	print(x - r)
	r = x
	k -= 1


an = [0 for i in range(100005)]
while True:
	try:
		(n, m) = map(int, input().split())
		an = list(map(int, input().split()))
	except EOFError:
		exit(0)
	an.sort()
	cnt = 0
	i = 0
	ans = 0
	while cnt < m:
		if i == n:
			print('0')
			cnt += 1
			continue
		if an[i] > ans:
			print(an[i] - ans)
			ans = an[i]
			cnt += 1
			i += 1
		else:
			i += 1
			continue


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
i = 0
som = 0
cnt = 0
while i < len(l) or cnt < k:
	if cnt == k:
		break
	if i >= len(l):
		cnt += 1
		print(0)
	elif l[i] - som != 0:
		print(l[i] - som)
		som = som + l[i] - som
		cnt += 1
	else:
		i += 1
		continue


(N, K) = map(int, input().split())
A = set((int(i) for i in input().split()))
A = list(A)
A.sort()
print(A[0])
for i in range(min(len(A) - 1, K - 1)):
	print(A[i + 1] - A[i])
if K - len(A) > 0:
	for i in range(K - len(A)):
		print(0)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l = list(set(l))
n = len(l)
f = 0
l.sort()
ind = 0
min1 = l[0]
min2 = l[0]
print(l[0])
for i in range(m - 1):
	if f == 1:
		print('0')
	elif l[ind] == 0:
		if ind + 1 < n:
			min1 = l[ind + 1]
			ind += 1
			print(min1)
		else:
			print('0')
			f = 1
	else:
		ind += 1
		if ind < n:
			min1 = l[ind] - min2
			min2 = l[ind]
			print(min1)
		else:
			print('0')
			f = 1


(n, k) = map(int, input().split())
A = set(map(int, input().split()))
A = sorted(list(A))
A = [0] + A
while len(A) <= k:
	A.append(A[-1])
for i in range(k):
	print(A[i + 1] - A[i])


(n, k) = map(int, input().split(' '))
ar = set(map(int, input().split(' ')))
ar = list(ar)
ar.sort()
print(ar[0])
sub = ar[0]
c = 1
for _ in range(k - 1):
	try:
		if ar[c] - sub != 0:
			print(ar[c] - sub)
			sub += ar[c] - sub
			c = c + 1
		elif ar[c + 1] - sub != 0:
			print(ar[c + 1] - sub)
			sub += ar[c] - sub
			c = c + 1
		else:
			print(0)
	except:
		print(0)


(n, k) = map(int, input().strip().split())
a = list(set(map(int, input().strip().split())))
a.sort()
print(a[0])
i = 1
j = 0
while j < k - 1 and i < len(a):
	print(a[i] - a[i - 1])
	i += 1
	j += 1
while j < k - 1:
	print(0)
	j += 1


a = list(map(int, input().split()))
b = list(set(map(int, input().split())))
b.sort()
Min = 0
for i in range(a[1]):
	if i >= len(b):
		print(0)
		continue
	print(b[i] - Min)
	Min = b[i]


I = lambda : map(int, input().split())
(_, k) = I()
A = sorted(set(I()))
n = len(A)
for i in range(1, n):
	A[-i] -= A[-i - 1]
for i in range(k):
	print(A[i] if i < n else 0)


(N, K) = map(int, input().split())
A = sorted(list(set(map(int, input().split()))))
j = 0
M = 0
for i in range(K):
	if j >= len(A):
		print('0')
		continue
	if A[j] - M > 0:
		print(A[j] - M)
		M += A[j] - M
		j += 1
	else:
		print('0')
		j += 1


(n, k) = map(int, input().split())
nums = list(map(int, input().split()))
nums.sort()
subbed = 0
i = 0
while k > 0:
	valid = i < n
	if not valid:
		print(0)
		k -= 1
		continue
	num = nums[i]
	i += 1
	if num == subbed:
		continue
	tosub = num - subbed
	print(tosub)
	k -= 1
	subbed = num


(n, k) = map(int, input().split())
ar = sorted(list(set([int(x) for x in input().split()])))
ar.extend([ar[-1]] * (k - len(ar)) + [0])
for p in range(k):
	print(ar[p] - ar[p - 1])


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
j = 0
s = 0
for i in range(k):
	if i == 0:
		print(l[0])
		s += l[0]
		j += 1
	else:
		while j < n and l[j] - s == 0:
			j += 1
		if j < n:
			mi = l[j] - s
			s += mi
			print(mi)
		else:
			print(0)


def find_min(n):
	for i in range(len(n)):
		if n[i] > 0:
			return i

def function(n, m):
	n = set(n)
	n = list(n)
	n.sort()
	d = len(n)
	s = find_min(n)
	if s != None:
		print(n[s])
		s += 1
		for j in range(m):
			while s < d and s < m:
				print(n[s] - n[s - 1])
				s += 1
		for _ in range(m - d):
			print(0)
	else:
		for i in range(m):
			print(0)
(n, m) = map(int, input().strip().split())
l = list(map(int, input().strip().split()))
function(l, m)


(n, k) = map(int, input().split())
x = list(map(int, input().split()))
x = sorted(x)
c = x[0]
i = 0
a = 1
print(x[0])
while i < n - 1 and a < k:
	i += 1
	t = x[i] - c
	if t <= 0:
		continue
	print(t)
	c += t
	a += 1
for i in range(k - a):
	print(0)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
sm = 0
for i in range(k):
	while n > 0 and a[0] == sm:
		a.pop(0)
		n -= 1
	if n == 0:
		print(0)
	else:
		print(a[0] - sm)
		sm = a[0]


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
prev = 0
ind = 0
for i in range(k):
	if ind == n:
		print(0)
		continue
	for j in range(ind + 1, n):
		if l[j] != l[ind]:
			break
		else:
			ind = j
	print(l[ind] - prev)
	prev = l[ind]
	ind += 1


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
i = 0
while i < n and a[i] == 0:
	i += 1
t = 0
si = 0
while t < k:
	if i < n:
		print(max(a[i] - si, 0))
		si += max(a[i] - si, 0)
		j = i
		while j < n and a[j] == a[i]:
			j += 1
		i = j
	else:
		print(0)
		i += 1
	t += 1


(n, k) = map(int, input().split())
a = sorted(list(set(map(int, input().split()))))
for i in range(k):
	try:
		if i == 0:
			print(a[i])
		else:
			print(a[i] - a[i - 1])
	except IndexError:
		print(0)


(n, k) = map(int, input().split())
l = list(set(list(map(int, input().split()))))
l.sort()
x = 0
j = 0
while k > 0:
	if j < len(l):
		l[j] = l[j] - x
		print(l[j])
		x += l[j]
		j += 1
	else:
		print(0)
	k -= 1


(n, k) = map(int, input().split())
l = sorted(map(int, input().split()))
(c, s) = (0, 0)
for x in range(k):
	(a, b, f) = (l[c], l[c] - s, 0)
	print(b)
	s += b
	for y in range(c + 1, n):
		if l[y] != a:
			c = y
			f = 1
			break
	if f == 0:
		break
for z in range(k - x - 1):
	print(0)


(n, k) = list(map(int, input().split(' ')))
x = sorted(set(list(map(int, input().split(' ')))))
for i in range(min(k, len(x))):
	print(x[i] - x[i - 1] if i != 0 else x[i])
print(*list('0' * (k - len(x))), sep='\n')


import math
(n, k) = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
arr.sort()
sub = 0
i = 0
ans = []
while i <= n - 1:
	while arr[i] - sub <= 0:
		i += 1
		if i == n:
			break
	if i == n:
		ans.append(0)
		break
	else:
		ans.append(arr[i] - sub)
		sub += arr[i] - sub
val = len(ans)
if val != k:
	ans.extend([0] * (k - val))
print(*ans[:k])


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
c = 0
l.sort()
i = 0
flag = False
d = 0
while c < k:
	if flag:
		print(0)
		c += 1
		continue
	if l[i] <= 0:
		i += 1
		if i == n:
			flag = True
		else:
			l[i] -= d
	else:
		print(l[i])
		d += l[i]
		l[i] = 0
		c += 1


(n, k) = list(map(int, input().split()))
array = list(map(int, input().split()))
array.sort()
i = 0
summ = 0
while k > 0 and i < n:
	array[i] -= summ
	if array[i] != 0:
		print(array[i])
		summ += array[i]
		k -= 1
	i += 1
while k > 0:
	print(0)
	k -= 1


(n, k) = map(int, input().split())
a = sorted(map(int, input().split()))
x = 0
b = []
for i in range(n):
	if x < a[i]:
		b.append(a[i] - x)
		x = a[i]
while len(b) < k:
	b.append(0)
for i in range(k):
	print(b[i])


(ns, ks) = input().split(' ')
n = int(ns)
k = int(ks)
a = [None] * n
a_str = input().split(' ')
for i in range(n):
	a[i] = int(a_str[i])
a = sorted(a)
sub_amt = 0
cnt = 0
l = 0
while cnt < k:
	if l >= n:
		print(0)
		cnt += 1
	else:
		a[l] -= sub_amt
		if a[l] <= 0:
			pass
		else:
			min_a = a[l]
			print(min_a)
			cnt += 1
			sub_amt += min_a
		l += 1


import sys
import math
import heapq
import bisect
from collections import Counter
from collections import defaultdict
from io import BytesIO, IOBase
import string

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None
		self.BUFSIZE = 8192

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def get_int():
	return int(input())

def get_ints():
	return list(map(int, input().split(' ')))

def get_int_grid(n):
	return [get_ints() for _ in range(n)]

def get_str():
	return input().strip()

def get_strs():
	return get_str().split(' ')

def flat_list(arr):
	return [item for subarr in arr for item in subarr]

def yes_no(b):
	if b:
		return 'YES'
	else:
		return 'NO'

def binary_search(good, left, right, delta=1, right_true=False):
	limits = [left, right]
	while limits[1] - limits[0] > delta:
		if delta == 1:
			mid = sum(limits) // 2
		else:
			mid = sum(limits) / 2
		if good(mid):
			limits[int(right_true)] = mid
		else:
			limits[int(~right_true)] = mid
	if good(limits[int(right_true)]):
		return limits[int(right_true)]
	else:
		return False

def prefix_sums(a):
	p = [0]
	for x in a:
		p.append(p[-1] + x)
	return p

def solve_b():
	(n, k) = get_ints()
	a = get_ints()
	b = {0}
	for x in a:
		b.add(x)
	c = list(b)
	c.sort()
	i = 1
	for _ in range(k):
		if i < len(c):
			print(c[i] - c[i - 1])
			i += 1
		else:
			print(0)
solve_b()


from sys import stdin, stdout
(n, k) = map(int, stdin.readline().split())
ary = list(map(int, stdin.readline().split()))
ary.sort()
sub = ary[0]
stdout.write('{}\n'.format(ary[0]))
i = 1
k -= 1
while k > 0 and i < n:
	ary[i] -= sub
	if ary[i] > 0:
		stdout.write('{}\n'.format(ary[i]))
		sub += ary[i]
		k -= 1
	i += 1
for i in range(k):
	stdout.write('{}\n'.format(0))


line1 = [int(x) for x in input().split()]
lst = [int(x) for x in input().split()]
(n, k) = line1

def apply_operation(lst, k):
	lst.sort()
	res = []
	lo = 0
	while len(res) < k and lo < len(lst):
		if not lo:
			res.append(lst[lo])
		elif lst[lo] - lst[lo - 1]:
			res.append(lst[lo] - lst[lo - 1])
		lo += 1
	for i in range(k - len(res)):
		res.append(0)
	return res
for x in apply_operation(lst, k):
	print(x)


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
s = 0
a = list(set(a))
a.sort()
n = len(a)
if n == 1 and a[0] == 0:
	print(0)
else:
	for i in range(0, k):
		if i >= n:
			print(0)
		elif i < n and a[i] - s > 0:
			print(a[i] - s)
			s += a[i] - s


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a = set(a)
a = list(a)
a.sort()
q = 0
l = [0 for i in range(k)]
for i in range(0, min(len(a), len(l))):
	l[i] = a[i]
for i in range(len(l)):
	p = l[i] - q
	if p > 0:
		print(p)
	else:
		print(0)
	q = q + p


(x, y) = map(int, input().split())
w = list(map(int, input().split()))
w.sort()
d = 0
k = 0
i = 0
while k < y:
	if i < x:
		w[i] -= d
		if w[i] == 0:
			i += 1
			continue
		print(w[i])
		k += 1
		d += w[i]
	else:
		print(0)
		k += 1
	i += 1


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
s = 0
c = 0
while c < k:
	if len(l) > 0:
		if l[0] == 0 or l[0] - s == 0:
			l.pop(0)
			c -= 1
		else:
			l[0] -= s
			s += l[0]
			print(l.pop(0))
	else:
		print(0)
	c += 1


(n, k) = map(int, input().strip().split())
arr = list(map(int, input().strip().split()))
ar = sorted(arr)
c = 0
dic = {}
arr = []
for i in range(n):
	if ar[i] not in dic:
		arr.append(ar[i])
		dic[ar[i]] = 21
n = len(arr)
for i in range(n):
	if arr[i] != 0:
		c = i
		break
z = 0
i = 0
for i in range(k):
	print(max(arr[c] - z, 0))
	z += max(arr[c] - z, 0)
	c = (c + 1) % n


(n, k) = map(int, input().split())
ll = list(map(int, input().split()))
ll = set(ll)
ll = list(ll)
ll.sort()
print(ll[0], sep=' ')
if k <= len(ll):
	for i in range(1, k):
		print(ll[i] - ll[i - 1], sep=' ')
else:
	for i in range(1, len(ll)):
		print(ll[i] - ll[i - 1], sep=' ')
	for i in range(len(ll) + 1, k + 1):
		print('0', sep=' ')


input_first = input('')
input_secnd = input('')
input_first_list = input_first.split(' ', 2)
input_secnd_list = input_secnd.split(' ', int(input_first_list[0]))
if len(input_secnd_list) > int(input_first_list[0]):
	input_secnd_list = [int(num) for num in input_secnd_list[0:-1]]
else:
	input_secnd_list = [int(num) for num in input_secnd_list]
count = 0
result_list = []
input_secnd_list.sort()
result_num = 0
for min_num in input_secnd_list:
	if min_num - result_num != 0 and min_num - result_num > 0:
		count += 1
		result_insrt = min_num - result_num
		result_num = min_num
		result_list.append(result_insrt)
		if count == int(input_first_list[1]):
			break
if result_num == 0:
	result_list.append(result_num)
for num in range(0, int(input_first_list[1])):
	if num < len(result_list):
		print(result_list[num])
	else:
		print(0)


(n, k) = map(int, input().split(' '))
pairs = map(int, input().split(' '))
pairs = list(pairs)
pairs.sort()
while pairs:
	if pairs[0] == 0:
		pairs.pop(0)
	else:
		break
length = len(pairs)
an = []
an.append(pairs[0])
for i in range(1, length):
	if pairs[i] != pairs[i - 1]:
		an.append(pairs[i])
total = 0
for i in range(k):
	if an == []:
		print('0')
		continue
	print(an[0] - total)
	total = an[0]
	an.pop(0)


(n, k) = map(int, input().split())
arr = sorted(set(map(int, input().split())))
j = 1
arr.insert(0, 0)
for i in range(0, k):
	if j == len(arr):
		print(0)
	else:
		print(arr[j] - arr[j - 1])
		j += 1


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr = sorted(arr)
s = set()
for i in arr:
	s.add(i)
l = []
for i in s:
	l.append(i)
l.sort()
print(l[0])
i = 1
j = 0
rr = 0
while i < len(l) and j < k - 1 and (rr < len(l)):
	if l[i] - l[rr] <= 0:
		break
	else:
		print(l[i] - l[rr])
		rr += 1
		i += 1
		j += 1
while j < k - 1:
	print(0)
	j += 1


f = lambda : map(int, input().split())
(n, k) = f()
l = sorted(list(set(f())))
print(l[0])
k -= 1
i = 1
while k != 0 and i < len(l):
	if l[i] - l[i - 1] > 0:
		print(l[i] - l[i - 1])
	i += 1
	k -= 1
for i in range(k, 0, -1):
	print(0)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l = list(set(l))
l.sort()
c = 0
for i in l:
	if k == 0:
		break
	print(i - c)
	c = i
	k -= 1
if k:
	while k:
		print(0)
		k -= 1


(n, k) = list(map(int, input().split()))
arr = sorted(list(map(int, input().split())))
ans = []
ans.append(arr[0])
for i in range(1, len(arr)):
	if arr[i] != arr[i - 1]:
		ans.append(arr[i] - arr[i - 1])
for i in range(k):
	if i < len(ans):
		print(ans[i])
	else:
		print(0)


from collections import deque
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
arr = deque(arr)
c = 0
for i in range(k):
	if len(arr) > 0:
		while True:
			p = arr.popleft() - c
			if p > 0 or len(arr) == 0:
				break
		if p > 0:
			print(p)
			c += p
		else:
			print(0)
	else:
		print(0)


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
s.sort()
a = 0
i = 0
st = 0
while st < k:
	while i < n and s[i] - a <= 0:
		i += 1
	if i >= n or s[i] - a <= 0:
		print(0)
	else:
		print(s[i] - a)
		a += s[i] - a
	i += 1
	st += 1


(n, k) = map(int, input().strip().split())
v = list(map(int, input().strip().split()))
v.sort()
sub = 0
i = 0
while k:
	if i >= n:
		a = 0
		k -= 1
		print(a)
	else:
		a = v[i] - sub
		sub = v[i]
		if a > 0:
			print(a)
			k -= 1
	i += 1


(n, k) = input().split()
(n, k) = [int(n), int(k)]
a = [int(i) for i in input().split()]
a.sort()
s = a[0]
print(a[0])
k -= 1
for i in range(1, n):
	if k == 0:
		break
	a[i] = a[i] - s
	if a[i] != 0:
		s += a[i]
		print(a[i])
		k -= 1
if k > 0:
	for i in range(0, k):
		print(0)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
x = a[0]
print(a[0])
k = k - 1
for i in range(1, len(a)):
	if k == 0:
		break
	if a[i] - x > 0:
		print(a[i] - x)
		k = k - 1
		c = a[i] - x
		x = x + c
for i in range(k):
	print(0)


Input = lambda : map(int, input().split())
Flag = False
Tmp = Start = 0
(n, k) = Input()
Num = sorted(list(Input()))
for i in range(k):
	for j in range(Start, n):
		if Num[j] - Tmp > 0:
			print(Num[j] - Tmp)
			Tmp += Num[j] - Tmp
			Num[j] = 0
			Flag = True
			Start = j + 1
			break
	if Flag == False:
		print(0)
		Start = n
	else:
		Flag = False


s = input().split()
(n, k) = (int(s[0]), int(s[1]))
s = input().split()
l = [int(i) for i in s]
l = list(set(l))
l.sort()
if k <= len(l):
	print(l[0])
	for i in range(1, k):
		print(l[i] - l[i - 1])
else:
	print(l[0])
	for i in range(1, len(l)):
		print(l[i] - l[i - 1])
	for i in range(len(l), k):
		print(0)


(n, k) = tuple(map(int, input().split()))
a = sorted(list(map(int, input().split())))
substracted = 0
for x in a:
	if k == 0:
		break
	if x - substracted <= 0:
		continue
	print(x - substracted)
	substracted += x - substracted
	k -= 1
while k > 0:
	k -= 1
	print(0)


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
a.sort()
sum_ = 0
i = 0
while k != 0:
	if i < n:
		a[i] -= sum_
		print(a[i])
		sum_ += a[i]
		i += 1
		while i < n and a[i] - sum_ == 0:
			i += 1
	else:
		print(0)
	k -= 1


(a, b) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
f = 0
sum = 0
for i in range(0, b, 1):
	while f < a and l[f] == sum:
		f += 1
	if f == a:
		print(0)
	else:
		print(l[f] - sum)
		sum = l[f]


from itertools import permutations
from collections import defaultdict
from math import *
import os
import sys
from io import BytesIO, IOBase
from heapq import nlargest
from bisect import *
import copy
import itertools
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
(val, i, c) = (0, 0, 0)
while val < k:
	if i < n and arr[i] - c != 0:
		if i < n:
			print(arr[i] - c)
			c += arr[i] - c
		else:
			print('0')
		val += 1
	elif i >= n:
		print('0')
		val += 1
	i += 1


tmp = input().split()
n = int(tmp[0])
k = int(tmp[1])
s = 1
tmp = input().split()
arr = []
for i in tmp:
	arr.append(int(i))
arr.sort()
if n == 1:
	if k >= 1:
		print(arr[0])
		s += 1
	while s <= k:
		print('0')
		s += 1
else:
	tmp = 0
	for i in range(n - 1):
		if (arr[i] != arr[i + 1] or i == n - 2) and s <= k:
			print(arr[i] - tmp)
			tmp = arr[i]
			s += 1
	if arr[n - 1] != arr[n - 2] and s <= k:
		print(arr[n - 1] - arr[n - 2])
		s += 1
	while s <= k:
		print('0')
		s += 1


(n, k) = map(int, input().split())
nums = sorted(list(map(int, input().split())))
index = 0
sumsub = 0
for i in range(k):
	while index < len(nums) and nums[index] - sumsub <= 0:
		index += 1
	if index >= len(nums):
		print(0)
		continue
	diff = nums[index] - sumsub
	print(diff)
	sumsub += diff
	index += 1


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = {}
for i in range(len(a)):
	if b.get(a[i], 0) == 0:
		b[a[i]] = 1
	else:
		b[a[i]] = b[a[i]] + 1
a = list(b.keys())
a.sort()
ans = []
ans.append(a[0])
for i in range(1, len(a)):
	ans.append(a[i] - a[i - 1])
if k > len(ans):
	k -= len(ans)
	for i in range(len(ans)):
		print(ans[i])
	while k > 0:
		print(0)
		k -= 1
else:
	for i in range(k):
		print(ans[i])


(n, k) = map(int, input().split(' '))
L = sorted([int(x) for x in input().split()])
s = 0
p = 0
while k > 0:
	k -= 1
	while p < n and L[p] == s:
		p += 1
	if p == n:
		print(0)
	else:
		print(L[p] - s)
		s = L[p]
		p += 1


import sys
from itertools import *
from cmath import *
input = sys.stdin.readline
from math import *

def inp():
	return int(input().strip())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def iss(s):
	return s == s[::-1]
(a, b) = invr()
ar = inlt()
li = [0]
for el in set(ar):
	li.append(el)
li.sort()
for i in range(1, b + 1):
	if i >= len(li):
		print('0')
	else:
		print(li[i] - li[i - 1])


(n, k) = map(int, input().split())
List = list(map(int, input().split()))
kn = 0
List.sort()
s = 0
for i in range(n):
	if kn == k:
		break
	if List[i] != 0 and List[i] - s != 0:
		print(List[i] - s)
		s += List[i] - s
		kn += 1
while kn != k:
	print(0)
	kn += 1


(n, k) = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
curr = 0
index = 0
for i in range(k):
	if arr[n - 1] == 0:
		index = n - 1
	for j in range(index, n):
		arr[j] = arr[j] - curr
		if arr[j] > 0:
			index = j
			curr += arr[j]
			break
	if arr[index] > 0:
		print(arr[index])
	else:
		print(0)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr = sorted(arr)
ind = 0
minus = 0
move = 0
for i in range(k):
	if ind > n - 1:
		print(0)
	else:
		print(arr[ind] - minus)
		minus += arr[ind] - minus
		ind += 1
		while ind < n and arr[ind] - minus == 0:
			ind += 1


nk = map(int, input().split())
n = next(nk)
k = next(nk)
values = [int(n) for n in input().split()]
values.sort()
sum_of_values = 0
count = 0
index = 0
while count < k:
	if index < n:
		new_value = values[index] - sum_of_values
		if new_value:
			print(new_value)
			sum_of_values += new_value
			count += 1
	else:
		print(0)
		count += 1
	index += 1


(n, k) = list(map(int, input().split()))
cl = list(map(int, input().split()))
cl = set(cl)
cl = sorted(list(cl))
n = len(cl)
sm = 0
if k > n:
	t = k - n
else:
	t = 0
for i in range(min(n, k)):
	print(cl[i] - sm)
	sm += cl[i] - sm
for i in range(t):
	print(0)


(n, k) = map(int, input().split())
arr = sorted(list(set(list(map(int, input().split())))))
curr = 0
summ = 0
for i in range(k):
	if curr == len(arr):
		print(0)
	else:
		print(arr[curr] - summ)
		summ = arr[curr]
		curr += 1


(n, k) = map(int, input().split())
a = sorted(set(map(int, input().split())))
m = 0
for x in a:
	if k == 0:
		break
	print(x - m)
	m = x
	k -= 1
while k:
	print(0)
	k -= 1


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l = list(set(l))
l.sort()
s = 0
if len(l) < k:
	for i in range(len(l)):
		l[i] = abs(l[i] - s)
		print(l[i])
		s += l[i]
	for j in range(k - len(l)):
		print('0')
else:
	for i in range(k):
		l[i] = l[i] - s
		print(l[i])
		s += l[i]


(n, k) = map(int, input().strip().split())
arr = list(map(int, input().strip().split()))
s = [0] + sorted(set(arr))
i = 0
for _ in range(k):
	if i >= len(s) - 1:
		i = len(s) - 1
	if s[i] == s[len(s) - 1]:
		print(0)
	else:
		print(s[i + 1] - s[i])
	i += 1


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr = sorted(arr)
sar = len(arr) - 1
ind = 0
while arr[ind] == 0 and ind < sar:
	ind += 1
sec = True
fir = False
minus = 0
for i in range(k):
	arr[ind] -= minus
	print(arr[ind])
	minus += arr[ind]
	while ind < sar and arr[ind] <= minus:
		ind += 1
	if ind == sar:
		minus = min(minus, arr[-1])


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a = sorted(a)
n = len(a)
i = 0
v = 0
while k > 0:
	if i >= n:
		print(0)
	else:
		print(a[i] - v)
		v += a[i] - v
		while i < n and a[i] - v == 0:
			i += 1
	k -= 1


(l, times) = map(int, input().split(' '))
line = list(map(int, input().split(' ')))
line.sort()
subtracted = 0
curri = 0
for _ in range(times):
	while curri < l and line[curri] <= subtracted:
		curri += 1
	if curri == l:
		print(0)
	else:
		v = line[curri]
		print(v - subtracted)
		subtracted = v