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: interview

Starter code:

Solutions:
(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,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)



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 = 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 = list(map(int, input().split()))
a = list(map(int, set(input().split())))
a.sort()
rk = iter(list(range(k)))
prv = 0
for x, _ in zip(a, rk):
	print(x - prv)
	prv = x
for __ in rk:
	print('0')


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


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

def mi():
	return list(map(int, input().split()))
'''
3 5
1 2 3
'''
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
'''
4 2
3 3 5 10
'''


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)


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)


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 = list(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 = 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, k = list(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())
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])

n, k = list(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 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

def __starting_point():
    main()

__starting_point()

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


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
            '''if n > 0:
                arr[-1] -= check'''

__starting_point()

#from collections import *
#from math import *
#from operator import *
I=lambda:list(map(int,input().split()))
n,k=list(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 = 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 ]


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

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 = [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