#include <cstdio>
#include <queue>
#include <iostream>
using namespace std;
int n,m;
char g[2020][2020];
int du[2020][2020];
typedef pair<int,int> pii;
queue<pii> q;

const int dx[] = {0,1,0,-1};
const int dy[] = {1,0,-1,0};

int check ( int x , int y )
{
    if ( x < 1 || x > n || y < 1 || y > m ) return 0;
    if ( g[x][y] == '.' ) return 1;
    return 0;
}
int main()
{
    scanf("%d%d",&n,&m);
    for ( int i = 1 ; i <= n ; i++ ) scanf("%s",g[i]+1);
    if ( n == 1 && m == 1 && g[1][1] == '*' ) {
        puts("*");
        return 0;
    }
    for ( int i = 1 ; i <= n ; i++ ) {
        for ( int j = 1 ; j <= m ; j++ ) {
            if ( g[i][j] == '.' ) {
                for ( int d = 0 ; d < 4 ; d++ ) du[i][j] += check(i+dx[d],j+dy[d]);
                if ( du[i][j] == 1 ) q.push(make_pair(i,j));
            }
        }
    }
    if ( q.empty() ) {
        puts("Not unique");
        return 0;
    }
    while ( !q.empty() ) {
        //cout << x << " " << y << endl;
        int x = q.front().first, y=q.front().second; q.pop();
        //if ( g[x][y] != '.' ) continue;
        //cout << x <<" " << y << endl;
        int tmp = -1;
        for ( int d = 0 ; d < 4 ; d++ ) {
            if ( g[x+dx[d]][y+dy[d]]=='.' ) { tmp=d; break; }
        }
        switch (tmp)
        {
            case -1:puts("Not unique"); return 0;
            case 0:g[x][y]='<';g[x][y+1]='>';break;
            case 1:g[x][y]='^';g[x+1][y]='v';break;
            case 2:g[x][y]='>';g[x][y-1]='<';break;
            case 3:g[x][y]='v';g[x-1][y]='^';break;
        }
        //cout << g[x][y] <<endl;
        du[x][y]--; du[x+dx[tmp]][y+dy[tmp]]--;
        x = x + dx[tmp] , y = y + dy[tmp];
        for ( int d = 0 ; d < 4 ; d++ )
            if (g[x+dx[d]][y+dy[d]]=='.')
            if ( (--du[x+dx[d]][y+dy[d]]) == 1 ) q.push(make_pair(x+dx[d],y+dy[d]));
    }
    if ( !q.empty() ) {
        puts("Not unique");
        return 0;
    }
    for ( int i = 1 ; i <= n; i++ )
        for ( int j =1 ; j <= m ; j++ )
    if ( g[i][j] == '.') {
        puts("Not unique"); return 0;
    }
    for ( int i = 1 ; i <= n ; i++ ) printf("%s\n",g[i]+1);
    return 0;
}


#include <cstdio>
#include <queue>
#include <iostream>
using namespace std;
int n,m;
char g[2020][2020];
int du[2020][2020];
typedef pair<int,int> pii;
queue<pii> q;

const int dx[] = {0,1,0,-1};
const int dy[] = {1,0,-1,0};

int check ( int x , int y )
{
    if ( x < 1 || x > n || y < 1 || y > m ) return 0;
    if ( g[x][y] == '.' ) return 1;
    return 0;
}
int main()
{
    scanf("%d%d",&n,&m);
    for ( int i = 1 ; i <= n ; i++ ) scanf("%s",g[i]+1);
    if ( n == 1 && m == 1 && g[1][1] == '*' ) {
        puts("*");
        return 0;
    }
    for ( int i = 1 ; i <= n ; i++ ) {
        for ( int j = 1 ; j <= m ; j++ ) {
            if ( g[i][j] == '.' ) {
                for ( int d = 0 ; d < 4 ; d++ ) du[i][j] += check(i+dx[d],j+dy[d]);
                if ( du[i][j] == 1 ) q.push(make_pair(i,j));
            }
        }
    }
    if ( q.empty() ) {
        puts("Not unique");
        return 0;
    }
    while ( !q.empty() ) {
        //cout << x << " " << y << endl;
        int x = q.front().first, y=q.front().second; q.pop();
        if ( g[x][y] != '.' ) continue;
        //cout << x <<" " << y << endl;
        int tmp = -1;
        for ( int d = 0 ; d < 4 ; d++ ) {
            if ( g[x+dx[d]][y+dy[d]]=='.' ) { tmp=d; break; }
        }
        switch (tmp)
        {
            case -1:puts("Not unique"); return 0;
            case 0:g[x][y]='<';g[x][y+1]='>';break;
            case 1:g[x][y]='^';g[x+1][y]='v';break;
            case 2:g[x][y]='>';g[x][y-1]='<';break;
            case 3:g[x][y]='v';g[x-1][y]='^';break;
        }
        //cout << g[x][y] <<endl;
        du[x][y]--; du[x+dx[tmp]][y+dy[tmp]]--;
        x = x + dx[tmp] , y = y + dy[tmp];
        for ( int d = 0 ; d < 4 ; d++ )
            if (g[x+dx[d]][y+dy[d]]=='.')
            if ( (--du[x+dx[d]][y+dy[d]]) == 1 ) q.push(make_pair(x+dx[d],y+dy[d]));
    }
    if ( !q.empty() ) {
        puts("Not unique");
        return 0;
    }
    for ( int i = 1 ; i <= n ; i++ ) printf("%s\n",g[i]+1);
    return 0;
}


#include <cstdio>
#include <queue>
#include <iostream>
using namespace std;
int n,m;
char g[2020][2020];
int du[2020][2020];
typedef pair<int,int> pii;
queue<pii> q;

const int dx[] = {0,1,0,-1};
const int dy[] = {1,0,-1,0};

int check ( int x , int y )
{
    if ( x < 1 || x > n || y < 1 || y > m ) return 0;
    if ( g[x][y] == '.' ) return 1;
    return 0;
}
int main()
{
    scanf("%d%d",&n,&m);
    for ( int i = 1 ; i <= n ; i++ ) scanf("%s",g[i]+1);
    if ( n == 1 && m == 1 && g[1][1] == '*' ) {
        puts("*");
        return 0;
    }
    for ( int i = 1 ; i <= n ; i++ ) {
        for ( int j = 1 ; j <= m ; j++ ) {
            if ( g[i][j] == '.' ) {
                for ( int d = 0 ; d < 4 ; d++ ) du[i][j] += check(i+dx[d],j+dy[d]);
                if ( du[i][j] == 1 ) q.push(make_pair(i,j));
            }
        }
    }
    if ( q.empty() ) {
        puts("Not unique");
        return 0;
    }
    while ( !q.empty() ) {
        //cout << x << " " << y << endl;
        int x = q.front().first, y=q.front().second; q.pop();
        if ( g[x][y] != '.' ) continue;
        //cout << x <<" " << y << endl;
        int tmp = -1;
        for ( int d = 0 ; d < 4 ; d++ ) {
            if ( g[x+dx[d]][y+dy[d]]=='.' ) { tmp=d; break; }
        }
        switch (tmp)
        {
            case -1:puts("Not unique"); return 0;
            case 0:g[x][y]='<';g[x][y+1]='>';break;
            case 1:g[x][y]='^';g[x+1][y]='v';break;
            case 2:g[x][y]='>';g[x][y-1]='<';break;
            case 3:g[x][y]='v';g[x-1][y]='^';break;
        }
        //cout << g[x][y] <<endl;
        du[x][y]--; du[x+dx[tmp]][y+dy[tmp]]--;
        x = x + dx[tmp] , y = y + dy[tmp];
        for ( int d = 0 ; d < 4 ; d++ )
            if (g[x+dx[d]][y+dy[d]]=='.')
            if ( (--du[x+dx[d]][y+dy[d]]) == 1 ) q.push(make_pair(x+dx[d],y+dy[d]));
    }
    if ( !q.empty() ) {
        puts("Not unique");
        return 0;
    }
    for ( int i = 1 ; i <= n; i++ )
        for ( int j =1 ; j <= m ; j++ )
    if ( g[i][j] == '.') {
        puts("Not unique"); return 0;
    }
    for ( int i = 1 ; i <= n ; i++ ) printf("%s\n",g[i]+1);
    return 0;
}


#include <cstdio>
#include <queue>
#include <iostream>
using namespace std;
int n,m;
char g[2020][2020];
int du[2020][2020];
typedef pair<int,int> pii;
queue<pii> q;

const int dx[] = {0,1,0,-1};
const int dy[] = {1,0,-1,0};

int check ( int x , int y )
{
    if ( x < 1 || x > n || y < 1 || y > m ) return 0;
    if ( g[x][y] == '.' ) return 1;
    return 0;
}
int main()
{
    scanf("%d%d",&n,&m);
    for ( int i = 1 ; i <= n ; i++ ) scanf("%s",g[i]+1);
    if ( n == 1 && m == 1 && g[1][1] == '*' ) {
        puts("*");
        return 0;
    }
    for ( int i = 1 ; i <= n ; i++ ) {
        for ( int j = 1 ; j <= m ; j++ ) {
            if ( g[i][j] == '.' ) {
                for ( int d = 0 ; d < 4 ; d++ ) du[i][j] += check(i+dx[d],j+dy[d]);
                if ( du[i][j] == 1 ) q.push(make_pair(i,j));
            }
        }
    }
    while ( !q.empty() ) {
        //cout << x << " " << y << endl;
        int x = q.front().first, y=q.front().second; q.pop();
        if ( g[x][y] != '.' ) continue;
        //cout << x <<" " << y << endl;
        int tmp = -1;
        for ( int d = 0 ; d < 4 ; d++ ) {
            if ( g[x+dx[d]][y+dy[d]]=='.' ) { tmp=d; break; }
        }
        switch (tmp)
        {
            //case -1:puts("Not unique"); return 0;
            case 0:g[x][y]='<';g[x][y+1]='>';break;
            case 1:g[x][y]='^';g[x+1][y]='v';break;
            case 2:g[x][y]='>';g[x][y-1]='<';break;
            case 3:g[x][y]='v';g[x-1][y]='^';break;
        }
        //cout << g[x][y] <<endl;
        //du[x][y]--; du[x+dx[tmp]][y+dy[tmp]]--;
        x = x + dx[tmp] , y = y + dy[tmp];
        for ( int d = 0 ; d < 4 ; d++ )
            if (g[x+dx[d]][y+dy[d]]=='.')
            if ( (--du[x+dx[d]][y+dy[d]]) == 1 ) {
                //cout << "#" << x+dx[d]<< " "<<y+dy[d]<<endl;
                q.push(make_pair(x+dx[d],y+dy[d]));
            }
    }

    for ( int i = 1 ; i <= n; i++ )
        for ( int j =1 ; j <= m ; j++ )
    if ( g[i][j] == '.') {
        puts("Not unique");
        return 0;
    }
    for ( int i = 1 ; i <= n ; i++ ) printf("%s\n",g[i]+1);
    return 0;
}


#include <cstdio>
#include <queue>
#include <iostream>
using namespace std;
int n,m;
char g[2020][2020];
int du[2020][2020];
typedef pair<int,int> pii;
queue<pii> q;

const int dx[] = {0,1,0,-1};
const int dy[] = {1,0,-1,0};

int check ( int x , int y )
{
    if ( x < 1 || x > n || y < 1 || y > m ) return 0;
    if ( g[x][y] == '.' ) return 1;
    return 0;
}
int main()
{
    scanf("%d%d",&n,&m);
    for ( int i = 1 ; i <= n ; i++ ) scanf("%s",g[i]+1);
    if ( n == 1 && m == 1 && g[1][1] == '*' ) {
        puts("*");
        return 0;
    }
    for ( int i = 1 ; i <= n ; i++ ) {
        for ( int j = 1 ; j <= m ; j++ ) {
            if ( g[i][j] == '.' ) {
                for ( int d = 0 ; d < 4 ; d++ ) du[i][j] += check(i+dx[d],j+dy[d]);
                if ( du[i][j] == 1 ) q.push(make_pair(i,j));
            }
        }
    }
    if ( q.empty() ) {
        puts("Not unique");
        return 0;
    }
    while ( !q.empty() ) {
        //cout << x << " " << y << endl;
        int x = q.front().first, y=q.front().second; q.pop();
        if ( du[x][y] == 0 || g[x][y] != '.' ) continue;
        //cout << x <<" " << y << endl;
        int tmp = -1;
        for ( int d = 0 ; d < 4 ; d++ ) {
            if ( g[x+dx[d]][y+dy[d]]=='.' ) { tmp=d; break; }
        }
        switch (tmp)
        {
            case -1:puts("Not unique"); return 0;
            case 0:g[x][y]='<';g[x][y+1]='>';break;
            case 1:g[x][y]='^';g[x+1][y]='v';break;
            case 2:g[x][y]='>';g[x][y-1]='<';break;
            case 3:g[x][y]='v';g[x-1][y]='^';break;
        }
        //cout << g[x][y] <<endl;
        du[x][y]--; du[x+dx[tmp]][y+dy[tmp]]--;
        x = x + dx[tmp] , y = y + dy[tmp];
        for ( int d = 0 ; d < 4 ; d++ )
            if (g[x+dx[d]][y+dy[d]]=='.')
            if ( (--du[x+dx[d]][y+dy[d]]) == 1 ) q.push(make_pair(x+dx[d],y+dy[d]));
    }
    if ( !q.empty() ) {
        puts("Not unique");
        return 0;
    }
    for ( int i = 1 ; i <= n ; i++ ) printf("%s\n",g[i]+1);
    return 0;
}


#include <cstdio>
#include <queue>
#include <iostream>
using namespace std;
int n,m;
char g[2020][2020];
int du[2020][2020];
typedef pair<int,int> pii;
queue<pii> q;

const int dx[] = {0,1,0,-1};
const int dy[] = {1,0,-1,0};

int check ( int x , int y )
{
    if ( x < 1 || x > n || y < 1 || y > m ) return 0;
    if ( g[x][y] == '.' ) return 1;
    return 0;
}
int main()
{
    scanf("%d%d",&n,&m);
    for ( int i = 1 ; i <= n ; i++ ) scanf("%s",g[i]+1);
    if ( n == 1 && m == 1 && g[1][1] == '*' ) {
        puts("*");
        return 0;
    }
    for ( int i = 1 ; i <= n ; i++ ) {
        for ( int j = 1 ; j <= m ; j++ ) {
            if ( g[i][j] == '.' ) {
                for ( int d = 0 ; d < 4 ; d++ ) du[i][j] += check(i+dx[d],j+dy[d]);
                if ( du[i][j] == 1 ) q.push(make_pair(i,j));
            }
        }
    }
    while ( !q.empty() ) {
        //cout << x << " " << y << endl;
        int x = q.front().first, y=q.front().second; q.pop();
        if ( g[x][y] != '.' ) continue;
        //cout << x <<" " << y << endl;
        int tmp = -1;
        for ( int d = 0 ; d < 4 ; d++ ) {
            if ( g[x+dx[d]][y+dy[d]]=='.' ) { tmp=d; break; }
        }
        switch (tmp)
        {
            //case -1:puts("Not unique"); return 0;
            case 0:g[x][y]='<';g[x][y+1]='>';break;
            case 1:g[x][y]='^';g[x+1][y]='v';break;
            case 2:g[x][y]='>';g[x][y-1]='<';break;
            case 3:g[x][y]='v';g[x-1][y]='^';break;
        }
        //cout << g[x][y] <<endl;
        //du[x][y]--; du[x+dx[tmp]][y+dy[tmp]]--;
        x = x + dx[tmp] , y = y + dy[tmp];
        for ( int d = 0 ; d < 4 ; d++ )
            if (g[x+dx[d]][y+dy[d]]=='.')
            if ( (--du[x+dx[d]][y+dy[d]]) == 1 ) {
                //cout << "#" << x+dx[d]<< " "<<y+dy[d]<<endl;
                q.push(make_pair(x+dx[d],y+dy[d]));
            }
    }

    for ( int i = 1 ; i <= n; i++ )
        for ( int j =1 ; j <= m ; j++ )
    if ( g[i][j] == '.') {
        puts("Not unique");
        //return 0;
    }
    for ( int i = 1 ; i <= n ; i++ ) printf("%s\n",g[i]+1);
    return 0;
}


#include <cstdio>
#include <queue>
#include <iostream>
using namespace std;
int n,m;
char g[2020][2020];
int du[2020][2020];
typedef pair<int,int> pii;
queue<pii> q;

const int dx[] = {0,1,0,-1};
const int dy[] = {1,0,-1,0};

int check ( int x , int y )
{
    if ( x < 1 || x > n || y < 1 || y > m ) return 0;
    if ( g[x][y] == '.' ) return 1;
    return 0;
}
int main()
{
    scanf("%d%d",&n,&m);
    for ( int i = 1 ; i <= n ; i++ ) scanf("%s",g[i]+1);
    if ( n == 1 && m == 1 && g[1][1] == '*' ) {
        puts("*");
        return 0;
    }
    for ( int i = 1 ; i <= n ; i++ ) {
        for ( int j = 1 ; j <= m ; j++ ) {
            if ( g[i][j] == '.' ) {
                for ( int d = 0 ; d < 4 ; d++ ) du[i][j] += check(i+dx[d],j+dy[d]);
                if ( du[i][j] == 1 ) q.push(make_pair(i,j));
            }
        }
    }
    if ( q.empty() ) {
        puts("Not unique");
        return 0;
    }
    while ( !q.empty() ) {
        //cout << x << " " << y << endl;
        int x = q.front().first, y=q.front().second; q.pop();
        if ( g[x][y] != '.' ) continue;
        //cout << x <<" " << y << endl;
        int tmp = -1;
        for ( int d = 0 ; d < 4 ; d++ ) {
            if ( g[x+dx[d]][y+dy[d]]=='.' ) { tmp=d; break; }
        }
        switch (tmp)
        {
            case -1:puts("Not unique"); return 0;
            case 0:g[x][y]='<';g[x][y+1]='>';break;
            case 1:g[x][y]='^';g[x+1][y]='v';break;
            case 2:g[x][y]='>';g[x][y-1]='<';break;
            case 3:g[x][y]='v';g[x-1][y]='^';break;
        }
        //cout << g[x][y] <<endl;
        du[x][y]--; du[x+dx[tmp]][y+dy[tmp]]--;
        x = x + dx[tmp] , y = y + dy[tmp];
        for ( int d = 0 ; d < 4 ; d++ )
            if (g[x+dx[d]][y+dy[d]]=='.')
            if ( (--du[x+dx[d]][y+dy[d]]) == 1 ) q.push(make_pair(x+dx[d],y+dy[d]));
    }
    if ( !q.empty() ) {
        puts("Not unique");
        return 0;
    }
    for ( int i = 1 ; i <= n; i++ )
        for ( int j =1 ; j <= m ; j++ )
    if ( g[i][j] == '*') {
        puts("Not unique"); return 0;
    }
    for ( int i = 1 ; i <= n ; i++ ) printf("%s\n",g[i]+1);
    return 0;
}


#include <cstdio>
#include <queue>
#include <iostream>
using namespace std;
int n,m;
char g[2020][2020];
int du[2020][2020];
typedef pair<int,int> pii;
queue<pii> q;

const int dx[] = {0,1,0,-1};
const int dy[] = {1,0,-1,0};

int check ( int x , int y )
{
    if ( x < 1 || x > n || y < 1 || y > m ) return 0;
    if ( g[x][y] == '.' ) return 1;
    return 0;
}
int main()
{
    scanf("%d%d",&n,&m);
    for ( int i = 1 ; i <= n ; i++ ) scanf("%s",g[i]+1);
    if ( n == 1 && m == 1 && g[1][1] == '*' ) {
        puts("*");
        return 0;
    }
    for ( int i = 1 ; i <= n ; i++ ) {
        for ( int j = 1 ; j <= m ; j++ ) {
            if ( g[i][j] == '.' ) {
                for ( int d = 0 ; d < 4 ; d++ ) du[i][j] += check(i+dx[d],j+dy[d]);
                if ( du[i][j] == 1 ) q.push(make_pair(i,j));
            }
        }
    }
    if ( q.empty() ) {
        puts("Not unique");
        return 0;
    }
    while ( !q.empty() ) {
        //cout << x << " " << y << endl;
        int x = q.front().first, y=q.front().second; q.pop();
        if ( du[x][y] == 0 || g[x][y] != '.' ) continue;
        // cout << x <<" " << y << endl;
        int tmp = -1;
        for ( int d = 0 ; d < 4 ; d++ ) {
            if ( g[x+dx[d]][y+dy[d]]=='.' ) { tmp=d; break; }
        }
        switch (tmp)
        {
            case -1:puts("Not unique"); return 0;
            case 0:g[x][y]='<';g[x][y+1]='>';break;
            case 1:g[x][y]='^';g[x+1][y]='v';break;
            case 2:g[x][y]='>';g[x][y-1]='<';break;
            case 3:g[x][y]='v';g[x-1][y]='^';break;
        }
        //cout << g[x][y] <<endl;
        du[x][y]--; du[x+dx[tmp]][y+dy[tmp]]--;
        x = x + dx[tmp] , y = y + dy[tmp];
        for ( int d = 0 ; d < 4 ; d++ )
            if (g[x+dx[d]][y+dy[y]]=='.')
            if ( (--du[x+dx[d]][y+dy[d]]) == 1 ) q.push(make_pair(x+dx[d],y+dy[d]));
    }
    if ( !q.empty() ) {
        puts("Not unique");
        return 0;
    }
    for ( int i = 1 ; i <= n ; i++ ) printf("%s\n",g[i]+1);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
inline int read()
{
	int t=1,sum=0;char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') t=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
		sum=sum*10+ch-'0',ch=getchar();
	return t*sum;
}
const int Max=2e3+10,Maxn=Max*Max;
int num[Max][Max],col[Max][Max],fir[Maxn],link[Maxn],vis[Maxn],n,m,cnt,tot;
char type[Max][Max]; int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
struct edge
{
	int to,nxt;
	edge () {}
	edge (int x,int y)
	{
		to=y; nxt=fir[x];
		fir[x]=cnt;
	}
}e[Max<<3];
bool check(int x,int y)
{
	if(x<1||y<1||x>n||y>m||type[x][y]=='*') return false;
	return true;
}
int find(int x)
{
	int i,j;
	for(i=fir[x];i;i=e[i].nxt)
	{
		j=e[i].to;
		if(vis[j]==tot) continue;
		vis[j]=tot;
		if(!link[j]||find(link[j]))
		{
			link[j]=x; link[x]=j;
			return 1;
		}
	}
	return 0;
}
int dfs(int x,int p)
{
	vis[x]=tot;
	int i,flag=0;
	if(p!=link[x])
		return dfs(link[x],x);
	else
	{
		for(i=fir[x];i;i=e[i].nxt)
			if(e[i].to!=p)
			{
				if(vis[e[i].to]>cnt&&vis[e[i].to]<tot)
					continue;
				if(vis[e[i].to]==tot)
					return 1;
				flag|=dfs(e[i].to,x);
			}
	}
	return flag;
}
int main()
{
	int i,j,k,xx,yy;
	n=read(); m=read();
	for(i=1;i<=n;i++)
	{
		scanf("%s",type[i]+1);
		for(j=1;j<=m;j++)
			col[i][j]=i+j&1,num[i][j]=++tot;
	}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*')
				for(k=0;k<4;k++)
					if(check(xx=i+dx[k],yy=j+dy[k]))
						e[++cnt]=edge(num[i][j],num[xx][yy]);
	cnt=tot=0;
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&col[i][j])
			{
				tot++;
				if(!find(num[i][j]))
				{
					puts("Not unique");
					return 0;
				}
			}
			else if(type[i][j]!='*')
				cnt++;
	if(tot!=cnt)
	{
		puts("Not unique");
		return 0;
	}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&vis[num[i][j]]<=cnt)
			{
				tot++;
				if(dfs(num[i][j],0))
				{
					puts("Not unique");
					return 0;
				}
			}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&!col[i][j])
			{
				k=link[num[i][j]];
				if(k==num[i][j]-1) type[i][j-1]='<',type[i][j]='>';
				else if(k==num[i][j+1]) type[i][j]='<',type[i][j+1]='>';
				else if(k<num[i][j]) type[i][j]='v',type[i-1][j]='^';
				else type[i][j]='^',type[i+1][j]='v';
			}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
			printf("%c",type[i][j]);
		printf("\n");
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
inline int read()
{
	int t=1,sum=0;char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') t=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
		sum=sum*10+ch-'0',ch=getchar();
	return t*sum;
}
const int Max=2e3+5,Maxn=Max*Max;
int deg[Maxn],d[Maxn][4],q[Maxn],vis[Max][Max],num[Max][Max],n,m,cnt,tot,ans;
char type[Max][Max]; int dx[]={-1,1,0,0},dy[]={0,0,-1,1};
bool check(int x,int y)
{
	if(x<0||y<0||x>n||y>m||type[x][y]=='*') return false;
	return true;
}
int main()
{
	int i,j,k,l,x,y,xx,yy;
	n=read(); m=read();
	for(i=1;i<=n;i++)
	{
		scanf("%s",type[i]+1);
		for(j=1;j<=m;j++)
			num[i][j]=++tot;
	}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*')
				for(k=0;k<4;k++)
					if(check(x=i+dx[k],y=j+dy[k]))
					{
						deg[num[x][y]]++;
						d[num[x][y]][k^1]=1;
					}
	cnt=tot=0;
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
		{
			if(deg[num[i][j]]==1)
				q[++tot]=i*10000+j;
			if(type[i][j]!='*')
				cnt++;
		}
	for(i=1;i<=tot;i++)
	{
		x=q[i]/10000; y=q[i]%10000; l=num[x][y];
		if(vis[x][y])
			continue;
		vis[x][y]=1;
		for(j=0;j<4;j++)
			if(d[l][j])
			{
				if(!j) type[x][y]='v',type[x-1][y]='^';
				else if(j==1) type[x][y]='^',type[x+1][y]='v';
				else if(j==2) type[x][y]='>',type[x][y-1]='<';
				else type[x][y]='<',type[x][y+1]='>';
				ans++; xx=x+dx[j]; yy=y+dy[j]; vis[xx][yy]=1;
			}
		for(j=0;j<4;j++)
			if(check(x=xx+dx[j],y=yy+dy[j])&&!vis[x][y])
			{
				d[num[x][y]][j^1]=0;
				if(--deg[num[x][y]]==1)
					q[++tot]=x*10000+y;
			}
	}
	if((cnt&1)||ans!=cnt/2)
		puts("Not unique");
	else
		for(i=1;i<=n;i++)
		{
			for(j=1;j<=m;j++)
				printf("%c",type[i][j]);
			printf("\n");
		}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
inline int read()
{
	int t=1,sum=0;char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') t=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
		sum=sum*10+ch-'0',ch=getchar();
	return t*sum;
}
const int Max=2e3+10,Maxn=Max*Max;
int num[Max][Max],col[Max][Max],fir[Maxn],link[Maxn],vis[Maxn],n,m,cnt,tot;
char type[Max][Max]; int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
struct edge
{
	int to,nxt;
	edge () {}
	edge (int x,int y)
	{
		to=y; nxt=fir[x];
		fir[x]=cnt;
	}
}e[Max<<3];
bool check(int x,int y)
{
	if(x<1||y<1||x>n||y>m||type[x][y]=='*') return false;
	return true;
}
int find(int x)
{
	int i,j;
	for(i=fir[x];i;i=e[i].nxt)
	{
		j=e[i].to;
		if(vis[j]==tot) continue;
		vis[j]=tot;
		if(!link[j]||find(link[j]))
		{
			link[j]=x; link[x]=j;
			return 1;
		}
	}
	return 0;
}
int dfs(int x,int p)
{
	vis[x]=tot;
	int i,flag=0;
	if(p!=link[x])
		return dfs(link[x],x);
	else
	{
		for(i=fir[x];i;i=e[i].nxt)
			if(e[i].to!=p)
			{
				if(vis[e[i].to]<tot)
					continue;
				if(vis[e[i].to]==tot)
					return 1;
				flag|=dfs(e[i].to,x);
			}
	}
	return flag;
}
int main()
{
	int i,j,k,xx,yy;
	n=read(); m=read();
	for(i=1;i<=n;i++)
	{
		scanf("%s",type[i]+1);
		for(j=1;j<=m;j++)
			col[i][j]=i+j&1,num[i][j]=++tot;
	}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*')
				for(k=0;k<4;k++)
					if(check(xx=i+dx[k],yy=j+dy[k]))
						e[++cnt]=edge(num[i][j],num[xx][yy]);
	cnt=tot=0;
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&col[i][j])
			{
				tot++;
				if(!find(num[i][j]))
				{
					puts("Not unique");
					return 0;
				}
			}
			else if(type[i][j]!='*')
				cnt++;
	if(tot!=cnt)
	{
		puts("Not unique");
		return 0;
	}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&vis[num[i][j]]<=cnt)
			{
				tot++;
				if(dfs(num[i][j],0))
				{
					puts("Not unique");
					return 0;
				}
			}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&!col[i][j])
			{
				k=link[num[i][j]];
				if(k==num[i][j]-1) type[i][j-1]='<',type[i][j]='>';
				else if(k==num[i][j+1]) type[i][j]='<',type[i][j+1]='>';
				else if(k<num[i][j]) type[i][j]='v',type[i-1][j]='^';
				else type[i][j]='^',type[i+1][j]='v';
			}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
			printf("%c",type[i][j]);
		printf("\n");
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
inline int read()
{
	int t=1,sum=0;char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') t=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
		sum=sum*10+ch-'0',ch=getchar();
	return t*sum;
}
const int Max=2e3+10,Maxn=Max*Max;
int num[Max][Max],col[Max][Max],fir[Maxn],link[Maxn],vis[Maxn],n,m,cnt,tot,Dfn;
int st[Maxn],end[Maxn];
char type[Max][Max]; int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
struct edge
{
	int to,nxt;
	edge () {}
	edge (int x,int y)
	{
		to=y; nxt=fir[x];
		fir[x]=cnt;
	}
}e[Max<<3];
bool check(int x,int y)
{
	if(x<1||y<1||x>n||y>m||type[x][y]=='*') return false;
	return true;
}
int find(int x)
{
	int i,j;
	for(i=fir[x];i;i=e[i].nxt)
	{
		j=e[i].to;
		if(vis[j]==tot) continue;
		vis[j]=tot;
		if(!link[j]||find(link[j]))
		{
			link[j]=x; link[x]=j;
			return 1;
		}
	}
	return 0;
}
int dfs(int x,int p)
{
	vis[x]=tot; st[x]=++Dfn;
	int flag=0;
	if(p!=link[x])
		flag=dfs(link[x],x);
	else
	{
		for(int i=fir[x];i;i=e[i].nxt)
			if(e[i].to!=p)
			{
				if(vis[e[i].to]==tot)
					if(end[e[i].to])
						continue;
					else
						return 1;
				if(vis[e[i].to]>cnt)
					continue;
				flag|=dfs(e[i].to,x);
				if(flag) return 1;
			}
	}
	end[x]=Dfn;
	return flag;
}
int main()
{
	int i,j,k,xx,yy;
	n=read(); m=read();
	for(i=1;i<=n;i++)
	{
		scanf("%s",type[i]+1);
		for(j=1;j<=m;j++)
			col[i][j]=i+j&1,num[i][j]=++tot;
	}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*')
				for(k=0;k<4;k++)
					if(check(xx=i+dx[k],yy=j+dy[k]))
						e[++cnt]=edge(num[i][j],num[xx][yy]);
	cnt=tot=0;
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&col[i][j])
			{
				tot++; Dfn=0;
				if(!find(num[i][j]))
				{
					puts("Not unique");
					return 0;
				}
			}
			else if(type[i][j]!='*')
				cnt++;
	if(tot!=cnt)
	{
		puts("Not unique");
		return 0;
	}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&vis[num[i][j]]<=cnt)
			{
				tot++;
				if(dfs(num[i][j],0))
				{
					puts("Not unique");
					return 0;
				}
			}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&!col[i][j])
			{
				k=link[num[i][j]];
				if(k==num[i][j]-1) type[i][j-1]='<',type[i][j]='>';
				else if(k==num[i][j+1]) type[i][j]='<',type[i][j+1]='>';
				else if(k<num[i][j]) type[i][j]='v',type[i-1][j]='^';
				else type[i][j]='^',type[i+1][j]='v';
			}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
			printf("%c",type[i][j]);
		printf("\n");
	}
	return 0;
}
/*
2 6
*....*
......
*/


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
inline int read()
{
	int t=1,sum=0;char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') t=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
		sum=sum*10+ch-'0',ch=getchar();
	return t*sum;
}
const int Max=2e3+10,Maxn=Max*Max;
int num[Max][Max],col[Max][Max],fir[Maxn],link[Maxn],vis[Maxn],n,m,cnt,tot,Dfn;
int st[Maxn],end[Maxn];
char type[Max][Max]; int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
struct edge
{
	int to,nxt;
	edge () {}
	edge (int x,int y)
	{
		to=y; nxt=fir[x];
		fir[x]=cnt;
	}
}e[Maxn<<2];
bool check(int x,int y)
{
	if(x<1||y<1||x>n||y>m||type[x][y]=='*') return false;
	return true;
}
int find(int x)
{
	int i,j;
	for(i=fir[x];i;i=e[i].nxt)
	{
		j=e[i].to;
		if(vis[j]==tot) continue;
		vis[j]=tot;
		if(!link[j]||find(link[j]))
		{
			link[j]=x; link[x]=j;
			return 1;
		}
	}
	return 0;
}
int dfs(int x,int p)
{
	vis[x]=tot; st[x]=++Dfn;
	int flag=0;
	if(p!=link[x])
		flag=dfs(link[x],x);
	else
	{
		for(int i=fir[x];i;i=e[i].nxt)
			if(e[i].to!=p)
			{
				if(vis[e[i].to]==tot)
					if(end[e[i].to])
						continue;
					else
						return 1;
				if(vis[e[i].to]>cnt)
					continue;
				flag|=dfs(e[i].to,x);
				if(flag) return 1;
			}
	}
	end[x]=Dfn;
	return flag;
}
int main()
{
	int i,j,k,xx,yy;
	n=read(); m=read();
	for(i=1;i<=n;i++)
	{
		scanf("%s",type[i]+1);
		for(j=1;j<=m;j++)
			col[i][j]=i+j&1,num[i][j]=++tot;
	}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*')
				for(k=0;k<4;k++)
					if(check(xx=i+dx[k],yy=j+dy[k]))
						e[++cnt]=edge(num[i][j],num[xx][yy]);
	cnt=tot=0;
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&col[i][j])
			{
				tot++; Dfn=0;
				if(!find(num[i][j]))
				{
					puts("Not unique");
					return 0;
				}
			}
			else if(type[i][j]!='*')
				cnt++;
	if(tot!=cnt)
	{
		puts("Not unique");
		return 0;
	}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&vis[num[i][j]]<=cnt)
			{
				tot++;
				if(dfs(num[i][j],0))
				{
					puts("Not unique");
					return 0;
				}
			}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&!col[i][j])
			{
				k=link[num[i][j]];
				if(k==num[i][j]-1) type[i][j-1]='<',type[i][j]='>';
				else if(k==num[i][j+1]) type[i][j]='<',type[i][j+1]='>';
				else if(k<num[i][j]) type[i][j]='v',type[i-1][j]='^';
				else type[i][j]='^',type[i+1][j]='v';
			}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
			printf("%c",type[i][j]);
		printf("\n");
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
inline int read()
{
	int t=1,sum=0;char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') t=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
		sum=sum*10+ch-'0',ch=getchar();
	return t*sum;
}
const int Max=2e3+10,Maxn=Max*Max;
int num[Max][Max],col[Max][Max],fir[Maxn],link[Maxn],vis[Maxn],n,m,cnt,tot;
char type[Max][Max]; int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
struct edge
{
	int to,nxt;
	edge () {}
	edge (int x,int y)
	{
		to=y; nxt=fir[x];
		fir[x]=cnt;
	}
}e[Max<<3];
bool check(int x,int y)
{
	if(x<1||y<1||x>n||y>m||type[x][y]=='*') return false;
	return true;
}
int find(int x)
{
	int i,j;
	for(i=fir[x];i;i=e[i].nxt)
	{
		j=e[i].to;
		if(vis[j]==tot) continue;
		vis[j]=tot;
		if(!link[j]||find(link[j]))
		{
			link[j]=x; link[x]=j;
			return 1;
		}
	}
	return 0;
}
int dfs(int x,int p)
{
	vis[x]=tot;
	int i,flag=0;
	if(p!=link[x])
		return dfs(link[x],x);
	else
	{
		for(i=fir[x];i;i=e[i].nxt)
			if(e[i].to!=p)
			{
				if(vis[e[i].to]<=cnt)
					continue;
				if(vis[e[i].to]==tot)
					return 1;
				flag|=dfs(e[i].to,x);
			}
	}
	return flag;
}
int main()
{
	int i,j,k,xx,yy;
	n=read(); m=read();
	for(i=1;i<=n;i++)
	{
		scanf("%s",type[i]+1);
		for(j=1;j<=m;j++)
			col[i][j]=i+j&1,num[i][j]=++tot;
	}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*')
				for(k=0;k<4;k++)
					if(check(xx=i+dx[k],yy=j+dy[k]))
						e[++cnt]=edge(num[i][j],num[xx][yy]);
	cnt=tot=0;
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&col[i][j])
			{
				tot++;
				if(!find(num[i][j]))
				{
					puts("Not unique");
					return 0;
				}
			}
			else if(type[i][j]!='*')
				cnt++;
	if(tot!=cnt)
	{
		puts("Not unique");
		return 0;
	}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&vis[num[i][j]]<=cnt)
			{
				tot++;
				if(dfs(num[i][j],0))
				{
					puts("Not unique");
					return 0;
				}
			}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&!col[i][j])
			{
				k=link[num[i][j]];
				if(k==num[i][j]-1) type[i][j-1]='<',type[i][j]='>';
				else if(k==num[i][j+1]) type[i][j]='<',type[i][j+1]='>';
				else if(k<num[i][j]) type[i][j]='v',type[i-1][j]='^';
				else type[i][j]='^',type[i+1][j]='v';
			}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
			printf("%c",type[i][j]);
		printf("\n");
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
inline int read()
{
	int t=1,sum=0;char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') t=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
		sum=sum*10+ch-'0',ch=getchar();
	return t*sum;
}
const int Max=2e3+10,Maxn=Max*Max;
int num[Max][Max],col[Max][Max],fir[Maxn],link[Maxn],vis[Maxn],n,m,cnt,tot,Dfn;
int st[Maxn],end[Maxn];
char type[Max][Max]; int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
struct edge
{
	int to,nxt;
	edge () {}
	edge (int x,int y)
	{
		to=y; nxt=fir[x];
		fir[x]=cnt;
	}
}e[Maxn<<2];
bool check(int x,int y)
{
	if(x<1||y<1||x>n||y>m||type[x][y]=='*') return false;
	return true;
}
int find(int x)
{
	int i,j;
	for(i=fir[x];i;i=e[i].nxt)
	{
		j=e[i].to;
		if(vis[j]==tot) continue;
		vis[j]=tot;
		if(!link[j]||find(link[j]))
		{
			link[j]=x; link[x]=j;
			return 1;
		}
	}
	return 0;
}
int dfs(int x,int p)
{
	vis[x]=tot; st[x]=++Dfn;
	int flag=0;
	if(p!=link[x])
		flag=dfs(link[x],x);
	else
	{
		for(int i=fir[x];i;i=e[i].nxt)
			if(e[i].to!=p)
			{
				if(vis[e[i].to]==tot)
					if(end[e[i].to])
						continue;
					else
						return 1;
				if(vis[e[i].to]>cnt)
					continue;
				flag|=dfs(e[i].to,x);
				if(flag) return 1;
			}
	}
	end[x]=Dfn;
	return flag;
}
int main()
{
	int i,j,k,xx,yy;
	n=read(); m=read();
	for(i=1;i<=n;i++)
	{
		scanf("%s",type[i]+1);
		for(j=1;j<=m;j++)
			col[i][j]=i+j&1,num[i][j]=++tot;
	}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*')
				for(k=0;k<4;k++)
					if(check(xx=i+dx[k],yy=j+dy[k]))
						e[++cnt]=edge(num[i][j],num[xx][yy]);
	cnt=tot=0;
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&col[i][j])
			{
				tot++; Dfn=0;
				if(!find(num[i][j]))
				{
					puts("Not unique");
					return 0;
				}
			}
			else if(type[i][j]!='*')
				cnt++;
	if(tot!=cnt)
	{
		puts("Not unique");
		return 0;
	}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&vis[num[i][j]]<=cnt)
			{
				tot++;
				if(dfs(num[i][j],0))
				{
					puts("Not unique");
					return 0;
				}
			}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&!col[i][j])
			{
				k=link[num[i][j]];
				if(k==num[i][j]-1)
					if(m==1) type[i-1][j]='^',type[i][j]='v';
					else type[i][j-1]='<',type[i][j]='>';
				else if(k==num[i][j+1])
					if(m==1) type[i][j]='^',type[i+1][j]='v';
					else type[i][j]='<',type[i][j+1]='>';
				else if(k<num[i][j]) type[i][j]='v',type[i-1][j]='^';
				else type[i][j]='^',type[i+1][j]='v';
			}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
			printf("%c",type[i][j]);
		printf("\n");
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
inline int read()
{
	int t=1,sum=0;char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') t=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
		sum=sum*10+ch-'0',ch=getchar();
	return t*sum;
}
const int Max=2e3+10,Maxn=Max*Max;
int num[Max][Max],col[Max][Max],fir[Maxn],link[Maxn],vis[Maxn],n,m,cnt,tot,Dfn;
int st[Maxn],end[Maxn];
char type[Max][Max]; int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
struct edge
{
	int to,nxt;
	edge () {}
	edge (int x,int y)
	{
		to=y; nxt=fir[x];
		fir[x]=cnt;
	}
}e[Maxn<<3];
bool check(int x,int y)
{
	if(x<1||y<1||x>n||y>m||type[x][y]=='*') return false;
	return true;
}
int find(int x)
{
	int i,j;
	for(i=fir[x];i;i=e[i].nxt)
	{
		j=e[i].to;
		if(vis[j]==tot) continue;
		vis[j]=tot;
		if(!link[j]||find(link[j]))
		{
			link[j]=x; link[x]=j;
			return 1;
		}
	}
	return 0;
}
int dfs(int x,int p)
{
	vis[x]=tot; st[x]=++Dfn;
	int flag=0;
	if(p!=link[x])
		flag=dfs(link[x],x);
	else
	{
		for(int i=fir[x];i;i=e[i].nxt)
			if(e[i].to!=p)
			{
				if(vis[e[i].to]==tot)
					if(end[e[i].to])
						continue;
					else
						return 1;
				if(vis[e[i].to]>cnt)
					continue;
				flag|=dfs(e[i].to,x);
				if(flag) return 1;
			}
	}
	end[x]=Dfn;
	return flag;
}
int main()
{
	int i,j,k,xx,yy;
	n=read(); m=read();
	for(i=1;i<=n;i++)
	{
		scanf("%s",type[i]+1);
		for(j=1;j<=m;j++)
			col[i][j]=i+j&1,num[i][j]=++tot;
	}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*')
				for(k=0;k<4;k++)
					if(check(xx=i+dx[k],yy=j+dy[k]))
						e[++cnt]=edge(num[i][j],num[xx][yy]);
	cnt=tot=0;
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&col[i][j])
			{
				tot++; Dfn=0;
				if(!find(num[i][j]))
				{
					puts("Not unique");
					return 0;
				}
			}
			else if(type[i][j]!='*')
				cnt++;
	if(tot!=cnt)
	{
		puts("Not unique");
		return 0;
	}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&vis[num[i][j]]<=cnt)
			{
				tot++;
				if(dfs(num[i][j],0))
				{
					puts("Not unique");
					return 0;
				}
			}
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
			if(type[i][j]!='*'&&!col[i][j])
			{
				k=link[num[i][j]];
				if(k==num[i][j]-1) type[i][j-1]='<',type[i][j]='>';
				else if(k==num[i][j+1]) type[i][j]='<',type[i][j+1]='>';
				else if(k<num[i][j]) type[i][j]='v',type[i-1][j]='^';
				else type[i][j]='^',type[i+1][j]='v';
			}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
			printf("%c",type[i][j]);
		printf("\n");
	}
	return 0;
}
/*
2 6
*....*
......
*/


#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <queue>

using namespace std;
#define MAXN 2000
struct node
{
    int x, y;
    node() {};
    node(int a, int b)
    {
        x = a;
        y = b;
    }
};
char gra[MAXN][MAXN];
int degree[MAXN][MAXN];
int row, clo, cnt;

bool check(int x, int y)
{
    if(x < 0 || x >= row || y < 0 || y >= clo)
        return false;
    return true;
}

int Move[4][2] = {{0,1}, {0, -1} ,{-1, 0}, {1, 0}};
char charA[4] = {'<','>','V','^'};
char charB[4] = {'>','<','^','V'};

int getDegree(int x,int y)
{
    if(gra[x][y]=='*')
        return 0;
    int sum=0;
    cnt++;
    for(int i=0; i<4; i++)
    {
        int newx =x+Move[i][0];
        int newy =y+Move[i][1];
        sum+=(check(newx,newy) && gra[newx][newy]!='*');
    }
    return sum;
}
queue<node> que;
void solve( )
{
    while(!que.empty()) que.pop();
    for(int i = 0; i < row; i++)
        for( int j = 0; j < clo; j++)
        {
            degree[i][j] = getDegree(i, j);
            if(degree[i][j] == 1)
                que.push(node(i, j));
        }
    while(!que.empty())
    {
        node now = que.front();
        que.pop();
        for( int i = 0; i < 4; i++)
        {
            int tex = now.x + Move[i][0];
            int tey = now.y + Move[i][1];
            if(check(tex, tey) && gra[tex][tey] == '.')
            {
                degree[now.x][now.y] = 0;
                degree[tex][tey] = 0;
                gra[now.x][now.y] = charA[i];
                gra[tex][tey] = charB[i];
                cnt -= 2;
                for( int k = 0; k < 4; k++)
                {
                    int ttx = tex + Move[k][0];
                    int tty = tex + Move[k][1];
                    if(check(ttx, tty) && gra[ttx][tty] == '.')
                        degree[ttx][tty]--;
                    if(degree[ttx][tty] == 1)
                        que.push(node(ttx, tty));
                }
            }
        }
    }
    if(cnt > 0)
        printf("Not unique\n");
    else
        for( int i = 0; i < row; i++)
            puts(gra[i]);

}
int main()
{
    while(scanf("%d %d",&row, &clo) != EOF)
    {
        cnt = 0;
        getchar();
        for( int i = 0; i < row; i++)
            gets(gra[i]);
        memset(degree, 0, sizeof(degree));
        solve();
    }
    return 0;
}


#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <queue>

using namespace std;
#define MAXN 2000
struct node
{
    int x, y;
    node() {};
    node(int a, int b)
    {
        x = a;
        y = b;
    }
};
char gra[MAXN][MAXN];
int degree[MAXN][MAXN];
int row, clo, cnt;

bool check(int x, int y)
{
    if(x < 0 || x >= row || y < 0 || y >= clo)
        return false;
    return true;
}
int Move[4][2] = {{0,1}, {0, -1} ,{-1, 0}, {1, 0}};
char charA[4] = {'<','>','v','^'};
char charB[4] = {'>','<','^','v'};

int getDegree(int x, int y)
{
    if(gra[x][y]=='*')
        return 0;
    int sum=0;
    cnt++;
    for(int i=0; i<4; i++)
    {
        int newx =x+Move[i][0];
        int newy =y+Move[i][1];
        if(check(newx, newy) && gra[newx][newy] == '.')
             sum++;
    }
    return sum;
}
queue<node> que;
void solve( )
{
    while(!que.empty()) que.pop();
    for(int i = 0; i < row; i++)
        for( int j = 0; j < clo; j++)
        {
            degree[i][j] = getDegree(i, j);
            if(degree[i][j] == 1)
                que.push(node(i, j));
        }
    while(!que.empty())
    {
        node now = que.front();
        que.pop();
       // cout<<"now.x  now.y"<<now.x <<" "<<now.y<<endl;
        for( int i = 0; i < 4; i++)
        {
            int tex = now.x + Move[i][0];
            int tey = now.y + Move[i][1];
            if(check(tex, tey) && degree[tex][tey])
            {
                degree[now.x][now.y] = 0;
                degree[tex][tey] = 0;
                gra[now.x][now.y] = charA[i];
                gra[tex][tey] = charB[i];
                cnt -= 2;
                //cout<<"tex tey"<<tex<<" "<<tey<<endl;
                for( int k = 0; k < 4; k++)
                {
                    int ttx = tex + Move[k][0];
                    int tty = tey + Move[k][1];
                    //cout<<ttx<<" "<<tty<<endl;
                    if(check(ttx, tty) && degree[ttx][tty])
                        degree[ttx][tty]--;
                    if(degree[ttx][tty] == 1)
                       que.push(node(ttx, tty));
                }
            }
        }
    }
    if(cnt > 0)
        printf("Not unique\n");
    else
        for( int i = 0; i < row; i++)
            puts(gra[i]);

}
int main()
{
    while(scanf("%d %d",&row, &clo) != EOF)
    {
        cnt = 0;
        getchar();
        for( int i = 0; i < row; i++)
            gets(gra[i]);
        memset(degree, 0, sizeof(degree));
        solve();
    }
    return 0;
}


#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <queue>

using namespace std;
#define MAXN 2000
struct node
{
    int x, y;
    node() {};
    node(int a, int b)
    {
        x = a;
        y = b;
    }
};
char gra[MAXN][MAXN];
int degree[MAXN][MAXN];
int row, clo, cnt;

bool check(int x, int y)
{
    if(x < 0 || x >= row || y < 0 || y >= clo)
        return false;
    return true;
}
int Move[4][2] = {{0,1}, {0, -1} ,{-1, 0}, {1, 0}};
char charA[4] = {'<','>','v','^'};
char charB[4] = {'>','<','^','v'};

int getDegree(int x,int y)
{
    if(gra[x][y]=='*')
        return 0;
    int sum=0;
    cnt++;
    for(int i=0; i<4; i++)
    {
        int newx =x+Move[i][0];
        int newy =y+Move[i][1];
        sum+=(check(newx,newy) && gra[newx][newy]!='*');
    }
    return sum;
}
queue<node> que;
void solve( )
{
    while(!que.empty()) que.pop();
    for(int i = 0; i < row; i++)
        for( int j = 0; j < clo; j++)
        {
            degree[i][j] = getDegree(i, j);
            if(degree[i][j] == 1)
                que.push(node(i, j));
        }
    while(!que.empty())
    {
        node now = que.front();
        que.pop();
        for( int i = 0; i < 4; i++)
        {
            int tex = now.x + Move[i][0];
            int tey = now.y + Move[i][1];
            if(check(tex, tey) && degree[tex][tey])
            {
                degree[now.x][now.y] = 0;
                degree[tex][tey] = 0;
                gra[now.x][now.y] = charA[i];
                gra[tex][tey] = charB[i];
                cnt -= 2;
                for( int k = 0; k < 4; k++)
                {
                    int ttx = tex + Move[k][0];
                    int tty = tex + Move[k][1];
                    if(check(ttx, tty) &&degree[ttx][tty])
                        degree[ttx][tty]--;
                    if(degree[ttx][tty] == 1)
                        que.push(node(ttx, tty));
                }
            }
        }
    }
    if(cnt > 0)
        printf("Not unique\n");
    else
        for( int i = 0; i < row; i++)
            puts(gra[i]);

}
int main()
{
    while(scanf("%d %d",&row, &clo) != EOF)
    {
        cnt = 0;
        getchar();
        for( int i = 0; i < row; i++)
            gets(gra[i]);
        memset(degree, 0, sizeof(degree));
        solve();
    }
    return 0;
}


#include <iostream>
#include <string.h>
#include <stdio.h>
#include <queue>

using namespace std;
#define MAXN 2020
char gra[MAXN][MAXN];
int degree[MAXN][MAXN];
int row, clo, cnt;

int Move[4][2] = {{0,1}, {0, -1} ,{-1, 0}, {1, 0}};
char charA[4] = {'<','>','v','^'};
char charB[4] = {'>','<','^','v'};

int getDegree(int x, int y)
{
    int sum=0;
    cnt++;
    for(int i=0; i<4; i++)
    {
        int newx =x+Move[i][0];
        int newy =y+Move[i][1];
        sum += (gra[newx][newy] == '.');
    }
    return sum;
}

void solve( )
{
    queue<pair<int,int> > que;
    for(int i = 1; i <= row; i++)
        for( int j = 1; j <= clo; j++)
        {
            if(gra[i][j] != '.') continue;
            degree[i][j] = getDegree(i, j);
            if(degree[i][j] == 1)
                que.push(make_pair(i, j));
        }
    pair<int, int > tem;
    while(!que.empty())
    {
        tem = que.front();
        int nowx = tem.first;
        int nowy = tem.second;
        que.pop();
        for( int i = 0; i < 4; i++)
        {
            //cout<<"dfs"<<endl;
            int tex = nowx + Move[i][0];
            int tey = nowy + Move[i][1];
            if( gra[tex][tey] == '.')
            {
                degree[nowx][nowy] = 0;
                degree[tex][tey] = 0;
                gra[nowx][nowy] = charA[i];
                gra[tex][tey] = charB[i];
                cnt -= 2;
                for( int k = 0; k < 4; k++)
                {
                    int ttx = tex + Move[k][0];
                    int tty = tey + Move[k][1];
                    if(gra[ttx][tty] == '.')
                        degree[ttx][tty]--;
                    if(degree[ttx][tty] == 1)
                       que.push(make_pair(ttx, tty));
                }
            }
        }
    }
    if(cnt)
        printf("Not unique\n");
    else
        for( int i = 1; i <= row; i++)
            puts(gra[i]+1);

}
int main()
{
    scanf("%d %d",&row, &clo);
    cnt = 0;
    getchar();
    for( int i = 1; i <= row; i++)
        gets(gra[i] + 1);
    memset(degree, 0, sizeof(degree));
    solve();

    return 0;
}


#include<iostream>
using namespace std;
int minValue(int *arr,int n,int pre){
	for(int i=0;i<n;i++)
		if(*(arr+i)>0)
			*(arr+i)-=pre;
	//finding min value;
	int zcount=0,min=1254124;
	for(int i=0;i<n;i++){
		if(*(arr+i)==0)
			zcount++;
		else if(*(arr+i)<min)
			min=*(arr+i);
	}
	if(zcount==n)
		return 0;
	return min;
}

int main(){
	int n,k;
	cin>>n>>k;
	int arr[n];
	for(int i=0;i<n;i++)
		cin>>arr[i];
	int min=0;
	int j=0;
	while(j<k){
		if(j>=n)
			cout<<0<<endl;
		else{
		min=minValue(arr,n,min);
		cout<<min<<endl;}
		j++;
	}
}


#include<iostream>
#include<stack>
using namespace std;
void swap(long int *a,long int *b){
	long int temp=*a;
	*a=*b;
	*b=temp;
}
int partition(long int *arr,int low,int high){
	long int pivot = *(arr+high);
	int i = low;
	for(int j=low;j<=high-1;j++){
		if(*(arr+j)<pivot){
			swap(arr+j,arr+i);
			i++;
		}
	}
	swap(arr+i,arr+high);
	return i;
}
void quickSort(long int *arr,int low,int high){
	if(low<high){
		int p=partition(arr,low,high);
		quickSort(arr,low,p-1);
		quickSort(arr,p+1,high);
	}
}

//stack
stack<int> s;
int total=0;
void pushData(int data){
	if(s.empty() || s.top()!=data)
		s.push(data);
}
int popData(){
	if(s.empty())
		return 0;
	int temp=total;
	total=s.top();
	s.pop();
	return total-temp;
}
int main(){
	int n,k;
	cin>>n>>k;
	long int arr[n];
	for(int i=0;i<n;i++)
		cin>>arr[i];
	quickSort(arr,0,n-1);
	//processing
	for(int i=n-1;i>=0;i--){
		pushData(arr[i]);
	}
	//printing
	while(k>0){
		cout<<popData()<<endl;
		k--;
	}

	return 0;
}


#include<iostream>
#include<map>
#include<iterator>

using namespace std;
int main(){
	map<long int,int> data;
	int n,k;
	cin>>n>>k;
//	long int *arr=new int[n];
	long int temp;
	for(int i=0;i<n;i++){
		cin>>temp;
		data.insert((pair<long int, int>(temp,0)));
	}
	//printing
	 map<long int, int>::iterator itr;
	 /*for (itr = data.begin(); itr != data.end(); ++itr) {
        cout << '\t' << itr->first
             << '\t' << itr->second << '\n';
    }*/
    itr=data.begin();
    int total=0;
    while(k>0){
    	if(itr==data.end())
    		cout<<"0"<<endl;
    	else{
    		temp=total;
    		total=itr->first;
    		cout<<itr->first-temp<<endl;
    		itr++;
		}
    	k--;
	}
}


#include<iostream>
using namespace std;
void swap(long int *a,long int *b){
	long int temp=*a;
	*a=*b;
	*b=temp;
}
int partition(long int *arr,int low,int high){
	long int pivot = *(arr+high);
	int i = low;
	for(int j=low;j<=high-1;j++){
		if(*(arr+j)<pivot){
			swap(arr+j,arr+i);
			i++;
		}
	}
	swap(arr+i,arr+high);
	return i;
}
void quickSort(long int *arr,int low,int high){
	if(low<high){
		int p=partition(arr,low,high);
		quickSort(arr,low,p-1);
		quickSort(arr,p+1,high);
	}
}
void removeDups(long int *arr,int n){
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			if(*(arr+i)==*(arr+j))
				*(arr+j)=0;
		}
	}
}
int shiftZero(long int *arr,int n){
	int count=0;
	for(int i=0;i<n;i++){
		if(arr[i]!=0){
			swap(arr+count,arr+i);
			count++;}
	}
	return count;
}
int main(){
	int n,k;
	cin>>n>>k;
	long int arr[n];
	for(int i=0;i<n;i++)
		cin>>arr[i];
	quickSort(arr,0,n-1);
	removeDups(arr,n);
	n=shiftZero(arr,n);
	//processing
	int total=0;
	int i=0;
	while(i<k){
		if(i>=n){
			cout<<0<<endl;
			i++;
		}
		else{
			cout<<arr[i]-total<<endl;
			i++;
			total=arr[i-1];
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int lln;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    lln n,k,i,j,x;
    cin>>n>>k;
    set<lln> s;
    set<lln>::iterator it;
    vector<lln> a;
    for(i=0;i<n;i++)
    {
        cin>>x;
        s.insert(x);
    }
    for(it=s.begin();it!=s.end();it++)
        a.push_back(*it);
    n=a.size();
    for(i=0;i<min(n,k);i++)
    {
        if(i==0)
            cout<<a[i]<<endl;
        else
            cout<<a[i]-a[i-1]<<endl;
    }
    for(i=min(n,k);i<k;i++)
        cout<<"0\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int lln;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    lln n,k,i,j,m;
    cin>>n>>k;
    lln a[n];
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    i=0;
    while(i<min(n,k))
    {
        while(i<n&&a[i]==0)
            i++;
        if(i==n)
            break;
        cout<<a[i]<<endl;
        for(j=n;j>=i;j--)
            a[j]-=a[i];
        i++;
    }
    for(j=i;j<k;j++)
        cout<<"0\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int lln;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    lln n,k,i,j,m;
    cin>>n>>k;
    lln a[n];
    vector<lln> ans;
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    i=0;
    while(i<min(n,k))
    {
        while(i<n&&a[i]==0)
            i++;
        if(i==n)
            break;
        ans.push_back(a[i]);
        for(j=n;j>=i;j--)
            a[j]-=a[i];
        i++;
    }
    for(j=0;j<ans.size();j++)
        cout<<ans[j]<<endl;
    for(j=ans.size();j<k;j++)
        cout<<"0\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int lln;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    lln n,k,i,j,x;
    cin>>n>>k;
    set<lln> s;
    set<lln>::iterator it;
    vector<lln> a;
    for(i=0;i<n;i++)
    {
        cin>>x;
        s.insert(x);
    }
    for(it=s.begin();it!=s.end();it++)
        a.push_back(*it);
    n=a.size();
    for(i=0;i<min(n,k);i++)
    {
        cout<<a[i]<<endl;
        for(j=n;j>=i;j--)
            a[j]-=a[i];
    }
    for(i=min(n,k);i<k;i++)
        cout<<"0\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int lln;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    lln n,k,i,j,m;
    cin>>n>>k;
    lln a[n];
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    for(i=0;i<min(n,k);i++)
    {
        m=9999999999;
        for(j=i;j<n;j++)
        {
            if(a[j]>0&&a[j]<m)
                m=a[j];
        }
        if(m==9999999999)
            break;
        cout<<m<<endl;
        for(j=i;j<n;j++)
            a[j]-=m;
    }
    for(j=i;j<k;j++)
        cout<<"0\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int lln;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    lln n,k,i,j,m;
    cin>>n>>k;
    lln a[n];
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    i=0;
    while(i<min(n,k))
    {
        while(i<n&&a[i]==0)
            i++;
        cout<<a[i]<<endl;
        for(j=n;j>=i;j--)
            a[j]-=a[i];
        i++;
    }
    for(j=i;j<k;j++)
        cout<<"0\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int size,k,i,j,count=0,r,t,x=1;
    cin>>size>>k;
    vector<int>vec;
    for(i=1;i<=size;i++)
    {
        cin>>j;
        vec.push_back(j);
    }
    sort(vec.begin(),vec.end());
    for(i=0;i<size;i++)
    {
        r=vec[i];
        if(r>0 && x<=k)
        {
           cout<<r<<endl;
           x++;
        }
        else if(x>k)
        {
            break;
        }
        count=count+vec[i];
        vec[i+1]=vec[i+1]-count;
    }
    if(k>x)
    {
        for(i=x;i<=k;i++)
        {
            cout<<0<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,i,in,j,s,x;
    cin>>n>>k;
    vector<int>vec;
    vector<int>::iterator it;
    vector<int>vec1;
    for(i=1; i<=n; i++)
    {
        cin>>in;
        vec.push_back(in);
    }
    sort(vec.begin(),vec.end());
    for(i=0; i<n-1; i++)
    {

        if(vec[i]==vec[i+1])
        {
            vec[i]=-1;
        }
    }
    for(i=0; i<n; i++)
    {
        if(vec[i]>0)
        {
            vec1.push_back(vec[i]);
        }
    }
    s=vec1.size();
    x=min(s,k);
    for(i=0; i<x; i++)
    {
        cout<<vec1[i]<<endl;
        for(j=i+1; j<s; j++)
        {

            vec1[j]=vec1[j]-vec1[i];
        }
    }
    if(x<k)
    {
        for(i=x; i<=k; i++)
        {
            cout<<0<<endl;
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int size,k,i,j,count=0,r,t,x=1;
    cin>>size>>k;
    vector<int>vec;
    for(i=1; i<=size; i++)
    {
        cin>>j;
        vec.push_back(j);
    }
    sort(vec.begin(),vec.end());
    for(i=0; i<size; i++)
    {
        r=vec[i];
        if(r>0 && x<=k)
        {
            x++;
            cout<<r<<endl;
        }
        else if(x>k)
        {
            break;
        }
        count=count+vec[i];
        vec[i+1]=vec[i+1]-count;
    }
    if(k>x)
    {
        for(i=x; i<=k; i++)
        {
            cout<<0<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,i,in,j,s,x;
    cin>>n>>k;
    vector<int>vec;
    vector<int>::iterator it;
    vector<int>vec1;
    for(i=1; i<=n; i++)
    {
        cin>>in;
        vec.push_back(in);
    }
    sort(vec.begin(),vec.end());
    for(i=0; i<n-1; i++)
    {

        if(vec[i]==vec[i+1])
        {
            vec[i]=-1;
        }
    }
    for(i=0; i<n; i++)
    {
        if(vec[i]>0)
        {
            vec1.push_back(vec[i]);
        }
    }
    s=vec1.size();
    x=min(s,k);
    for(i=0; i<x; i++)
    {
        cout<<vec1[i]<<endl;
        for(j=i+1; j<s; j++)
        {

            vec1[j]=vec1[j]-vec1[i];
        }
    }
    if(x<k)
    {
        for(i=x; i<k; i++)
        {
            cout<<0<<endl;
        }

    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,i,j,in,mi,si;
	cin>>n>>k;
	 set<int>s;
	 set<int>:: iterator it;
	 vector<int>vec;
    for(i=1;i<=n;i++)
    {
       cin>>in;
       s.insert(in);

    }
    si=s.size();
    for(it=s.begin();it!=s.end();it++)
    {
    	vec.push_back(*it);
    }
     mi=min(si,k);
    for(i=0;i<mi;i++)
    {
    	cout<<vec[i]<<endl;
    	for(j=i+1;j<si;j++)
    	{
    		vec[j]=vec[j]-vec[i];
    	}
    }

    if(k>mi)
    {
    	for(i=mi;i<k;i++)
    	{
    		cout<<0<<endl;
    	}
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int size,k,i,j,count=0,r,t,x;
    cin>>size>>k;
    vector<int>vec;
    for(i=1; i<=size; i++)
    {
        cin>>j;
        vec.push_back(j);
    }
    sort(vec.begin(),vec.end());
    x=1;
    for(i=0; i<size; i++)
    {
        r=vec[i];
        if(r>0 && x<=k)
        {
            ++x;
            cout<<r<<endl;
        }
        else if(x>k)
        {
            break;
        }
        count=count+vec[i];
        vec[i+1]=vec[i+1]-count;
    }
    x=x-1;
    if(k>x)
    {
        for(i=x; i<=k; i++)
        {
            cout<<0<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,i,in,j,s;
    cin>>n>>k;
    vector<int>vec;
    vector<int>::iterator it;
    vector<int>vec1;
    for(i=1; i<=n; i++)
    {
        cin>>in;
        vec.push_back(in);
    }
    sort(vec.begin(),vec.end());
    for(i=0; i<n-1; i++)
    {

        if(vec[i]==vec[i+1])
        {
            vec[i]=-1;
        }
    }
    for(i=0;i<n;i++)
    {
        if(vec[i]>0)
        {
          vec1.push_back(vec[i]);
        }
    }
    s=vec1.size();
    for(i=0;i<k;i++)
    {
        cout<<vec1[i]<<endl;
        for(j=i+1;j<s;j++)
        {

            vec1[j]=vec1[j]-vec1[i];
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,i,j,in,mi,si;
	cin>>n>>k;
	 set<int>s;
	 set<int>:: iterator it;
	 vector<int>vec;
	 mi=min(n,k);
    for(i=1;i<=n;i++)
    {
       cin>>in;
       s.insert(in);

    }
    si=s.size();
    for(it=s.begin();it!=s.end();it++)
    {
    	vec.push_back(*it);
    }
    for(i=0;i<mi;i++)
    {
    	cout<<vec[i]<<endl;
    	for(j=i+1;j<si;j++)
    	{
    		vec[j]=vec[j]-vec[i];
    	}
    }
    if(k>mi)
    {
    	for(i=mi;i<k;i++)
    	{
    		cout<<0<<endl;
    	}
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int size,k,i,j,count=0,r,t,x=0;
    cin>>size>>k;
    vector<int>vec;
    for(i=1; i<=size; i++)
    {
        cin>>j;
        vec.push_back(j);
    }
    sort(vec.begin(),vec.end());
    vec.push_back(0);
    for(i=0; i<size; i++)
    {
        r=vec[i];
        if(r>0 && x<k)
        {
            x++;
            cout<<r<<endl;
        }
        else if(x>k)
        {
            break;
        }
        count=count+vec[i];
        vec[i+1]=vec[i+1]-count;
    }
    if(k>x)
    {
        for(i=x; i<k; i++)
        {
            cout<<0<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int size,k,i,j,count=0,r,t,x=0;
    cin>>size>>k;
    vector<int>vec;
    for(i=1; i<=size; i++)
    {
        cin>>j;
        vec.push_back(j);
    }
    sort(vec.begin(),vec.end());
    for(i=0; i<size; i++)
    {
        r=vec[i];
        if(r>0 && x<k)
        {
            x++;
            cout<<r<<endl;
        }
        else if(x>k)
        {
            break;
        }
        count=count+vec[i];
        vec[i+1]=vec[i+1]-count;
    }
    if(k>x)
    {
        for(i=x; i<k; i++)
        {
            cout<<0<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int size,k,i,j,count=0,r,t,x=0;
    cin>>size>>k;
    vector<int>vec;
    for(i=1; i<=size; i++)
    {
        cin>>j;
        vec.push_back(j);
    }
    sort(vec.begin(),vec.end());
    for(i=0; i<size; i++)
    {
        r=vec[i];
        if(r>0 && x<=k)
        {
            x++;
            cout<<r<<endl;
        }
        else if(x>k)
        {
            break;
        }
        count=count+vec[i];
        vec[i+1]=vec[i+1]-count;
    }
    if(k>x)
    {
        for(i=x; i<k; i++)
        {
            cout<<0<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int mai[100005];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>mai[i];

	sort(mai+1,mai+n+1);

	int pos = 1,sub = 0;
	while(k--){
		while(mai[pos]-sub <=0 && pos<=n)
			pos++;
		if(pos > n)
			cout<< "0" << endl;
		else
			cout << mai[pos]-sub << endl;
		sub+=(mai[pos]-sub);
	}

}


#include <bits/stdc++.h>

using namespace std;

#define IoFast ios_base::sync_with_stdio(0);cin.tie(0);
#define ll long long int
#define float long double
#define foor(i, a, b) for ( int (i) = (a); (i)<(b); (i)++ )
#define foor2(i, a, b) for( int (i) = (a); (i)>(b); (i)-- )
#define foorl(i, a, b) for ( ll (i) = (a); (i)<(b); (i)++ )
#define foorl2(i, a, b) for( ll (i) = (a); (i)>(b); (i)-- )
#define mp make_pair
#define f1 first
#define f2 second
#define pb push_back
#define pii pair<int,int>
#define vpii vector <pii>
#define vi vector<int>
#define sz(a) (int) a.size( )
#define fillArr(n, a) foor(i, 0, n) cin >> a[i];
#define print(a) cout << #a << endl;
#define umax(a,b) a = max ( a, b )
#define umin(a,b) a = min ( a, b )
#define all(k) k.begin ( ), k.end( )
#define rall(k) k.rbegin ( ), k.rend( )
#define clean(k) memset( k, 0, sizeof(k) )
#define endl '\n'

const int maxn = 100050;
int ar[maxn];

int main() {
	IoFast;
	int n,k;

	cin >> n >> k;

	foor(i,0,n)
		cin >> ar[i];

	sort(ar,ar+n);

	int pos = 0,sum = 0;
	while(k--){
		while(ar[pos] - sum <= 0 && pos <= n-1)
			pos ++;
		if (pos > n-1)
			cout << "0" << endl;
		else
			cout << ar[pos] - sum << endl;
		sum += ar[pos] - sum;
	}
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	long long n,k;
	cin >> n >> k;
	long long ar[n];
	for (long long i=0;i<n;i++){
		long long ab;
		cin >> ab;
		ar[i]=ab;
	}

	for (long long i=0;i<k;i++){
		long long max= *max_element(ar,ar+n);
		if(max==0){
			cout << 0 << endl;
			continue;
		}

		long long min=1000000001;
		for (long long j=0;j<n;j++){
			if(ar[j]!=0 && ar[j]<min)
				min =ar[j];
		}
		cout << min << endl;
		for (long long j=0;j<n;j++){
			ar[j]-=min;
			if(ar[j]<0)
				ar[j]=0;
		}

	}
}


#include <bits/stdc++.h>
using namespace std;

int main(){
	long long n,k;
	cin >> n >> k;
	long long ar[n];
	for (long long i=0;i<n;i++){
		long long ab;
		cin >> ab;
		ar[i]=ab;
	}

	for (long long i=0;i<k;i++){
		long long max= *max_element(ar,ar+n);
		if(max==0){
			cout << 0 << endl;
			continue;
		}

		long long min=1000000001;
		for (long long j=0;j<n;j++){
			if(ar[j]!=0 && ar[j]<min)
				min =ar[j];
		}
		cout << min << endl;
		for (long long j=0;j<n;j++){
			ar[j]-=min;
			if(ar[j]<0)
				ar[j]=0;
		}

	}
}


#include<bits/stdc++.h>
using namespace std;

int mai[100005];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>mai[i];

	sort(mai+1,mai+n+1);

	int pos = 1,sub = 0;
	while(k--){
		while(a[pos]-sub <=0 && pos<=n)
			pos++;
		if(pos > n)
			cout<< "0" << endl;
		else
			cout << a[pos]-sub << endl;
		sub+=(a[pos]-sub);
	}

}


#include <bits/stdc++.h>
using namespace std;

vector<long long> del(vector<long long> ar,long long koft){
	long long ii=0;
	while (true){
		if(ar[ii]-koft<1 && ar.size()>1)
			ar.erase(ar.begin());
		else
			break;
	}
	return ar;
}

int main(){
	ios::sync_with_stdio(false);
	long long n,k;
	cin >> n >> k;
	vector<long long> ar;
	for (long long i=0;i<n;i++){
		long long ab;
		cin >> ab;
		ar.push_back(ab);
	}
	sort(ar.begin(),ar.begin()+n);
	long long koft=0;
	ar=del(ar,koft);
	//for (int i=0;i<ar.size();i++)
	//	cout << ar[i] <<endl;
	//cout << endl;
	for (long long i=0;i<k;i++){
	//	cout << ar.size() << "f" << endl;
		if(ar.size()==1 && ar[0]==0){
			cout << 0 << endl;
			continue;
		}
		int min=ar[0]-koft;
		cout << min << endl;
		koft+=min;
		ar=del(ar,koft);

	}
}


#include <bits/stdc++.h>
using namespace std;

vector<long long> del(vector<long long> ar){
	long long ii=0;
	while (true){
		if(ar[ii]==0 && ar.size()>1)
			ar.erase(ar.begin());
		else
			break;
	}
	return ar;
}

int main(){
	ios::sync_with_stdio(false);
	long long n,k;
	cin >> n >> k;
	vector<long long> ar;
	for (long long i=0;i<n;i++){
		long long ab;
		cin >> ab;
		ar.push_back(ab);
	}
	sort(ar.begin(),ar.begin()+n);
	ar=del(ar);
	//for (int i=0;i<ar.size();i++)
	//	cout << ar[i] <<endl;
	//cout << endl;
	for (long long i=0;i<k;i++){
	//	cout << ar.size() << "f" << endl;
		if(ar.size()==1 && ar[0]==0){
			cout << 0 << endl;
			continue;
		}
		int min=ar[0];
		cout << min << endl;
		for (int j=0;j<ar.size();j++){
			ar[j]-=min;
		}
		ar=del(ar);

	}
}


#include <bits/stdc++.h>
using namespace std;

vector<long long> del(vector<long long> ar,long long koft){
	long long ii=0;
	while (true){
		if(ar[ii]-koft<1 && ar.size()>1)
			ar.erase(ar.begin());
		else
			break;
	}
	return ar;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	long long n,k;
	cin >> n >> k;
	vector<long long> ar;
	for (long long i=0;i<n;i++){
		long long ab;
		cin >> ab;
		ar.push_back(ab);
	}
	sort(ar.begin(),ar.begin()+n);
	long long koft=0;
	ar=del(ar,koft);
	//for (int i=0;i<ar.size();i++)
	//	cout << ar[i] <<endl;
	//cout << endl;
	for (long long i=0;i<k;i++){
	//	cout << ar.size() << "f" << endl;
		if(ar.size()==1 && ar[0]==0){
			cout << 0 << endl;
			continue;
		}
		int min=ar[0]-koft;
		cout << min << endl;
		koft+=min;
		ar=del(ar,koft);

	}
}


#include <bits/stdc++.h>

#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define clr(arr, k) (memset(arr, k, sizeof(arr)))
#define lpv(i,a,n) 	for(int i=a;i<(int)n;i++)
#define ll long long

using namespace std;

const double EPS = (1e-8);
const double PI = acos(-1.0);
const ll INF = 1e9;

int dcmp(double x, double y) {
	return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1;
}

int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a % b);
}
int lcm(int a, int b) {
	return (a * b) / gcd(a, b);
}
void contest() {
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.in", "w", stdout);
#endif
}

using namespace std;

int arr[100001];

int main() {
	int n, k;
	cin >> n >> k;
	for (int i = 0; i < n; ++i)
		cin >> arr[i];
	sort(arr, arr+n);
	int minNum = arr[0], nextNum = 0;
	cout << minNum << "\n";
	bool ok = false;
	for (int i = 1; i < k; ++i) {
		for (int i = 0; i < n; ++i) {
			if(arr[i] - minNum < 0 || arr[i] == 1000000009)
				arr[i] = 1000000009;
			else
				arr[i] -= minNum;
			if(!ok && arr[i] > 0 && arr[i] <= 100000 )
				nextNum = arr[i], ok = true;
		}
		if(ok)
			cout << nextNum << "\n";
		else
			cout << 0 << "\n";
		ok = false, nextNum = minNum;
	}
	return 0;
}


#include <bits/stdc++.h>

#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define clr(arr, k) (memset(arr, k, sizeof(arr)))
#define lpv(i,a,n) 	for(int i=a;i<(int)n;i++)
#define ll long long

using namespace std;

const double EPS = (1e-8);
const double PI = acos(-1.0);
const ll INF = 1e9;

int dcmp(double x, double y) {
	return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1;
}

int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a % b);
}
int lcm(int a, int b) {
	return (a * b) / gcd(a, b);
}
void contest() {
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.in", "w", stdout);
#endif
}

using namespace std;

int main() {
	int n, k, a;
	cin >> n >> k;
	deque<int> deq;
	for (int i = 0; i < n; ++i) {
		cin >> a;
		deq.push_back(a);
	}
	sort(deq.begin(), deq.end());
	int minNum;
	for (int i = 0; i < k; ++i) {
		minNum = deq.front();
		if(deq.empty()) {
			for (; i < k; ++i)
				cout << 0 << "\n";
			break;
		} else {
			cout << minNum << "\n";
			  for (std::deque<int>::iterator it = deq.begin(); it!=deq.end(); ++it) {
				if(*it - minNum <= 0) {
					deq.pop_front();
				} else {
					*it = *it - minNum;
				}
			}
		}
	}
//	for (int j = 1; j < k; ++j) {
//		minNum = arr[0];
//		for (int i = 0; i < n; ++i) {
//			if(arr[i] - minNum <= 0 || arr[i] == 1000000009)
//				arr[i] = 1000000009;
//			else
//				arr[i] -= minNum;
//		}
//		sort(arr, arr+n);
//		if(arr[0] != 0 && arr[0] != 1000000009) {
//			cout << arr[0];
//		} else {
//			cout << 0;
//		}
//		cout << "\n";
//	}
	return 0;
}


#include <bits/stdc++.h>

#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define clr(arr, k) (memset(arr, k, sizeof(arr)))
#define lpv(i,a,n) 	for(int i=a;i<(int)n;i++)
#define ll long long

using namespace std;

const double EPS = (1e-8);
const double PI = acos(-1.0);
const ll INF = 1e9;

int dcmp(double x, double y) {
	return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1;
}

int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a % b);
}
int lcm(int a, int b) {
	return (a * b) / gcd(a, b);
}
void contest() {
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.in", "w", stdout);
#endif
}

using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	int arr[n+1];
	for (int i = 0; i < n; ++i)
		cin >> arr[i];
	sort(arr, arr+n);
//	int minNum = arr[0], nextNum = 0, idx = 1;
//	while(minNum == 0 && idx <= n) {
//		minNum = arr[idx++];
//	}
	int minNum = arr[0];
	cout << minNum << "\n";
	for (int j = 1; j < k; ++j) {
		minNum = arr[0];
		for (int i = 0; i < n; ++i) {
			if(arr[i] - minNum <= 0 || arr[i] == 1000000009)
				arr[i] = 1000000009;
			else
				arr[i] -= minNum;
		}
		sort(arr, arr+n);
		if(arr[0] != 0 && arr[0] != 1000000009) {
			cout << arr[0];
		} else {
			cout << 0;
		}
		cout << "\n";
	}
	return 0;
}


#include <bits/stdc++.h>

#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define clr(arr, k) (memset(arr, k, sizeof(arr)))
#define lpv(i,a,n) 	for(int i=a;i<(int)n;i++)
#define ll long long

using namespace std;

const double EPS = (1e-8);
const double PI = acos(-1.0);
const ll INF = 1e9;

int dcmp(double x, double y) {
	return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1;
}

int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a % b);
}
int lcm(int a, int b) {
	return (a * b) / gcd(a, b);
}
void contest() {
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.in", "w", stdout);
#endif
}

using namespace std;

int arr[100001];

int main() {
	vector<int> vec;
	int n, k, a;
	cin >> n >> k;
	arr[0] = 0;
	for (int i = 1; i <= n; ++i)
		cin >> arr[i];
	sort(arr, arr + n);
	for (int i = 0; i < n; ++i) {
		if(arr[i+1] - arr[i] > 0)
			vec.push_back(arr[i+1] - arr[i]);
	}
	int vecSize = sz(vec);
	if(k > vecSize) {
		for (int i = 0; i < vecSize; ++i)
			cout << vec[i] << "\n";
		for (int i = vecSize; i < k; ++i) {
			cout << 0 << "\n";
		}
	} else {
		for (int i = 0; i < k; ++i)
			cout << vec[i] << "\n";
	}
	return 0;
}


#include <bits/stdc++.h>

#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define clr(arr, k) (memset(arr, k, sizeof(arr)))
#define lpv(i,a,n) 	for(int i=a;i<(int)n;i++)
#define ll long long

using namespace std;

const double EPS = (1e-8);
const double PI = acos(-1.0);
const ll INF = 1e9;

int dcmp(double x, double y) {
	return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1;
}

int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a % b);
}
int lcm(int a, int b) {
	return (a * b) / gcd(a, b);
}
void contest() {
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.in", "w", stdout);
#endif
}

using namespace std;

int arr[100001];

int main() {
	int n, k, a;
	cin >> n >> k;
	for (int i = 0; i < n; ++i)
		cin >> arr[i];
	sort(arr, arr + n);
	int curr = arr[0], idx = 0, ok = 1, j = 0, i = 0;
	for (j = 0; j < k; ++j) {
		ok = 0;
		cout << curr << "\n";
		for (i = idx; i < n; ++i) {
			arr[i] -= curr;
			if (!ok && arr[i] > 0) {
				ok = i;
			}
		}
		if (!ok)
			break;
		curr = arr[ok], idx = ok;
	}
	j++;
	for (; j < k; ++j) {
		cout << 0 << "\n";
	}
	return 0;
}


#include <bits/stdc++.h>

#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define clr(arr, k) (memset(arr, k, sizeof(arr)))
#define lpv(i,a,n) 	for(int i=a;i<(int)n;i++)
#define ll long long

using namespace std;

const double EPS = (1e-8);
const double PI = acos(-1.0);
const ll INF = 1e9;

int dcmp(double x, double y) {
	return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1;
}

int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a % b);
}
int lcm(int a, int b) {
	return (a * b) / gcd(a, b);
}
void contest() {
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.in", "w", stdout);
#endif
}

using namespace std;

int arr[100001];

int main() {
	vector<int> vec;
	vector<int> ele;
	int n, k, a;
	cin >> n >> k;
	ele.push_back(0);
	for (int i = 1; i <= n; ++i) {
		cin >> a;
		ele.push_back(a);
	}
	sort(ele.begin(), ele.end());
	for (int i = 0; i < n; ++i) {
		if(ele[i+1] - ele[i] > 0)
			vec.push_back(ele[i+1] - ele[i]);
	}
	int vecSize = sz(vec);
	if(k > vecSize) {
		for (int i = 0; i < vecSize; ++i)
			cout << vec[i] << "\n";
		for (int i = vecSize; i < k; ++i) {
			cout << 0 << "\n";
		}
	} else {
		for (int i = 0; i < k; ++i)
			cout << vec[i] << "\n";
	}
	return 0;
}


#include <bits/stdc++.h>

#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define clr(arr, k) (memset(arr, k, sizeof(arr)))
#define lpv(i,a,n) 	for(int i=a;i<(int)n;i++)
#define ll long long

using namespace std;

const double EPS = (1e-8);
const double PI = acos(-1.0);
const ll INF = 1e9;

int dcmp(double x, double y) {
	return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1;
}

int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a % b);
}
int lcm(int a, int b) {
	return (a * b) / gcd(a, b);
}
void contest() {
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.in", "w", stdout);
#endif
}

using namespace std;

int arr[100001];

int main() {
	int n, k, a;
	cin >> n >> k;
	for (int i = 0; i < n; ++i)
		cin >> arr[i];
	sort(arr, arr + n);
	int curr = arr[0], idx = 0, ok = 1, j = 0, i = 0;
	for (j = 0; j < k; ++j) {
		ok = 0;
		cout << curr << "\n";
		for (i = idx; i < n; ++i) {
			arr[i] -= curr;
			if (!ok && arr[i] > 0) {
				ok = i;
			}
		}
		if (!ok)
			break;
		curr = arr[ok], idx = ok;
	}
	for (; j < k; ++j) {
		cout << 0 << "\n";
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
bool wayToSort(int i, int j)
{
    return i < j;
}
int nr=0,i,n,k,u,l,p,a[201];
int main()
{

    cin>>n>>k;

    for(i=1; i<=n; i++)
        cin>>a[i];
    sort(a,a+n+1);
    p=a[1];
    nr=1;
    cout<<p<<endl;
    for(i=2; i<=n; i++)
    {
        if(a[i]!=p)   //cout<<a[i]<<' ';
        {
            nr++;
            l=a[i]-p; //cout<<l<<' ';
            if(nr<=k)
            {
                cout<<l<<endl;
                p=a[i];
            }
        }
    }
    if(nr<k)
    {
        while(nr<k)
        {
            nr++;
            cout<<0<<endl;
        }
    }
return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
int nr=0,i,n,k,u,l,p,a[101];
int main()
{

    cin>>n>>k;

    for(i=1; i<=n; i++)
        cin>>a[i];
    sort(a,a+n+1);
    p=a[1];
    nr=1;
    cout<<p<<endl;
    for(i=2; i<=n; i++)
    {
        if(a[i]!=p)   //cout<<a[i]<<' ';
        {
            nr++;
            l=a[i]-p; //cout<<l<<' ';
            if(nr<=k)
            {
                cout<<l<<endl;
                p=a[i];
            }
        }
    }
    if(nr<k)
    {
        while(nr<k)
        {
            nr++;
            cout<<0<<endl;
        }
    }

    /*cin>>n>>k;
    for(i=1; i<=n; i++)
        cin>>a[i];

    while(x<k)
    {
        s=0;
        for(i=1; i<=n; i++)
            s=s+a[i];
        if(s==0)
        {
            cout<<0<<endl;
            x++;
        }
        else
        {
            x++;
            p=1;
            while(a[p]==0)
                p++;
            mino=a[p];
            for(j=p+1; j<=n; j++)
            {
                if (a[j]!=0 && a[j]<mino)
                    mino=a[j];
            }
            for(j=1; j<=n; j++)
            {
                if (a[j]!=0)
                    a[j]=a[j]-mino;
            }
            cout<<mino<<endl;
        }
    }
    */

    return 0;
}


#include <iostream>
using namespace std;
long long n,k,a[1001],i,p,j,mino,x=0,s,r,ok=0;
int main()
{
    cin>>n>>k;
    for(i=1; i<=n; i++)
        cin>>a[i];

    while(x<k)
    {
        s=0;
        for(i=1; i<=n; i++)
            s=s+a[i];
        if(s==0)
        {
            cout<<0<<endl;
            x++;
        }
        else
        {
            x++;
            p=1;
            while(a[p]==0)
                p++;
            mino=a[p];
            for(j=p+1; j<=n; j++)
            {
                if (a[j]!=0 && a[j]<mino)
                    mino=a[j];
            }
            for(j=1; j<=n; j++)
            {
                if (a[j]!=0)
                    a[j]=a[j]-mino;
            }
            cout<<mino<<endl;
        }
    }

    return 0;
}


#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
bool wayToSort(int i, int j) { return i < j; }
long n,k,a[1001],i,j,mino,s,p,u,x;
int main()
{

    cin>>n>>k;

    for(i=1; i<=n; i++)
        cin>>a[i];
    sort(a,a+n+1);
    //for(i=1; i<=n; i++) cout<<a[i]<<' ';
    //cout<<a[n]<<endl;

    while(x<k)
    {
        //cout<<a[n]<<' ';
        if (a[n]==0)
        {
            x++;
            cout<<0<<endl;
        }
        else
        {
            x++;
            p=1;
            while(a[p]==0)
                p++;
                u=a[p];
            cout<<a[p]<<endl;
            for(i=1; i<=n; i++)
            {
                if(a[i]!=0)
                    a[i]=a[i]-u;
            }
            //for(i=1; i<=n; i++) cout<<"A"<<a[i]<<' ';

        }
    }

    /*cin>>n>>k;
    for(i=1; i<=n; i++)
        cin>>a[i];

    while(x<k)
    {
        s=0;
        for(i=1; i<=n; i++)
            s=s+a[i];
        if(s==0)
        {
            cout<<0<<endl;
            x++;
        }
        else
        {
            x++;
            p=1;
            while(a[p]==0)
                p++;
            mino=a[p];
            for(j=p+1; j<=n; j++)
            {
                if (a[j]!=0 && a[j]<mino)
                    mino=a[j];
            }
            for(j=1; j<=n; j++)
            {
                if (a[j]!=0)
                    a[j]=a[j]-mino;
            }
            cout<<mino<<endl;
        }
    }
    */

    return 0;
}


#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
bool wayToSort(int i, int j)
{
    return i < j;
}
int nr=0,i,n,k,u,a[201];
int main()
{

    cin>>n>>k;

    for(i=1; i<=n; i++)
        cin>>a[i];
    sort(a,a+n+1);
    i=1;
    u=a[i];
    cout<<u;
    nr++;
    cout<<endl;
    while(nr<k)
    {

        while(a[i]==a[i+1])
            i++;
        if (i<n)
        {
            nr++;
            u=a[i+1]-a[i];
            i++;
            cout<<u<<endl;
        }
        else
        {
            nr++;
            cout<<0<<endl;
        }

    }

    /*cin>>n>>k;
    for(i=1; i<=n; i++)
        cin>>a[i];

    while(x<k)
    {
        s=0;
        for(i=1; i<=n; i++)
            s=s+a[i];
        if(s==0)
        {
            cout<<0<<endl;
            x++;
        }
        else
        {
            x++;
            p=1;
            while(a[p]==0)
                p++;
            mino=a[p];
            for(j=p+1; j<=n; j++)
            {
                if (a[j]!=0 && a[j]<mino)
                    mino=a[j];
            }
            for(j=1; j<=n; j++)
            {
                if (a[j]!=0)
                    a[j]=a[j]-mino;
            }
            cout<<mino<<endl;
        }
    }
    */

    return 0;
}


#include <iostream>
using namespace std;
int n,k,a[1001],i,p,j,mino,x=0,s,r,ok=0;
int main()
{
        cin>>n>>k;
        for(i=1;i<=n;i++)
            cin>>a[i];

           while(x<k)
           {    s=0;
               for(i=1;i<=n;i++) s=s+a[i];
               if(s==0) {cout<<0<<endl;x++;}
               else
               {
                   x++;
                   p=1;
                   while(a[p]==0) p++;
                   mino=a[p];
                   //cout<<mino<<' ';
                   //cout<<p;
                   for(j=p+1;j<=n;j++)
                   { //cout<<j<<' ';
                       if (a[j]!=0 && a[j]<mino) mino=a[j];
                   }
                   for(j=1;j<=n;j++)
                   {
                       if (a[j]!=0) a[j]=a[j]-mino;
                   }

                   cout<<mino<<endl;
               }

           }

    return 0;
}


#include <iostream>
using namespace std;
long n,k,a[1001],i,p,j,mino,x=0,s,r,ok=0;
int main()
{
    cin>>n>>k;
    for(i=1; i<=n; i++)
        cin>>a[i];

    while(x<k)
    {
        s=0;
        for(i=1; i<=n; i++)
            s=s+a[i];
        if(s==0)
        {
            cout<<0<<endl;
            x++;
        }
        else
        {
            x++;
            p=1;
            while(a[p]==0)
                p++;
            mino=a[p];
            for(j=p+1; j<=n; j++)
            {
                if (a[j]!=0 && a[j]<mino)
                    mino=a[j];
            }
            for(j=1; j<=n; j++)
            {
                if (a[j]!=0)
                    a[j]=a[j]-mino;
            }
            cout<<mino<<endl;
        }
    }

    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
long nr=0,i,n,k,u,l,p,a[100001];
int main()
{

    cin>>n>>k;

    for(i=1; i<=n; i++)
        cin>>a[i];
    sort(a,a+n+1);
    p=a[1];
    nr=1;
    cout<<p<<endl;
    for(i=2; i<=n; i++)
    {
        if(a[i]!=p)   //cout<<a[i]<<' ';
        {
            nr++;
            l=a[i]-p; //cout<<l<<' ';
            if(nr<=k)
            {
                cout<<l<<endl;
                p=a[i];
            }
        }
    }
    if(nr<k)
    {
        while(nr<k)
        {
            nr++;
            cout<<0<<endl;
        }
    }

    /*cin>>n>>k;
    for(i=1; i<=n; i++)
        cin>>a[i];

    while(x<k)
    {
        s=0;
        for(i=1; i<=n; i++)
            s=s+a[i];
        if(s==0)
        {
            cout<<0<<endl;
            x++;
        }
        else
        {
            x++;
            p=1;
            while(a[p]==0)
                p++;
            mino=a[p];
            for(j=p+1; j<=n; j++)
            {
                if (a[j]!=0 && a[j]<mino)
                    mino=a[j];
            }
            for(j=1; j<=n; j++)
            {
                if (a[j]!=0)
                    a[j]=a[j]-mino;
            }
            cout<<mino<<endl;
        }
    }
    */

    return 0;
}


/******************************************
--------***ID:ADNAN KISMETOVIC***----------
----***USER:kismetovic-codeforces.com***---
*******************************************/
#include <bits/stdc++.h>

using namespace std;

long long n,k,a,minimalan=1;
vector<long long> v;

int najmanji(){
	long long minimum=1000000000;
	//if(max(v[0],v[n-1])==0) return 0;
	for(int i=0;i<v.size();i++){
		if(v[i]==0) continue;
		else if(v[i]<minimum){
			minimum=v[i];
		}
	}
	if(minimum<1000000000)
	return minimum;
	else return 0;
}

int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a;
		v.push_back(a);
	}
	for(int i=0;i<k;i++){
		if(minimalan==0){
			cout<<0<<endl;
			continue;
		}
		minimalan=najmanji();
		cout<<minimalan<<endl;
		if(minimalan==0) continue;
		for(int j=0;j<n;j++){
			if(v[j]==0) continue;
			else{
				v[j]-=minimalan;
			}
		}
	}
	return 0;
}


/******************************************
--------***ID:ADNAN KISMETOVIC***----------
----***USER:kismetovic-codeforces.com***---
*******************************************/
#include <bits/stdc++.h>

using namespace std;

long long n,k,a,minimalan=0;
vector<long long> v;

int najmanji(){
	long long minimum=1000000000;
	for(int i=0;i<v.size();i++){
		if(v[i]==0) continue;
		else if(v[i]<minimum){
			minimum=v[i];
		}
	}
	if(minimum<1000000000)
	return minimum;
	else return 0;
}

int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a;
		v.push_back(a);
	}
	for(int i=0;i<k;i++){
		if(*max_element(v.begin(),v.end())==0){
			cout<<0<<endl;
			continue;
		}
		minimalan=najmanji();
		if(minimalan==0){
			cout<<0<<endl;
			continue;
		}
		cout<<minimalan<<endl;
		for(int j=0;j<n;j++){
			if(v[j]==0) continue;
			else{
				v[j]-=minimalan;
			}
		}
	}
	return 0;
}


/******************************************
--------***ID:ADNAN KISMETOVIC***----------
----***USER:kismetovic-codeforces.com***---
*******************************************/
#include <bits/stdc++.h>

using namespace std;

long long n,k,a[100000000],minimalan=0;

int najmanji(){
	sort(a,a+n);
	if(max(a[0],a[n-1])==0) return 0;
	for(int i=0;i<n;i++){
		if(a[i]==0) continue;
		else{
			return a[i];
		}
	}
	return 0;
}

int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<k;i++){
		minimalan=najmanji();
		if(minimalan==0){
			for(int j=i;j<k;j++)
			cout<<minimalan<<endl;
			break;
		}
		else{
			for(int j=0;j<n;j++){
				if(a[j]==0) continue;
				else{
					a[j]-=minimalan;
				}
			}
		}
		cout<<minimalan<<endl;
	}
	return 0;
}


/******************************************
--------***ID:ADNAN KISMETOVIC***----------
----***USER:kismetovic-codeforces.com***---
*******************************************/
#include <bits/stdc++.h>

using namespace std;

long long n,k,a,minimalan=0;
vector<long long> v;

int najmanji(){
	sort(v.begin(),v.end());
	if(max(v[0],v[n-1])==0) return 0;
	for(int i=0;i<v.size();i++){
		if(v[i]==0) continue;
		else{
			return v[i];
		}
	}
	return 0;
}

int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a;
		v.push_back(a);
	}
	for(int i=0;i<k;i++){
		minimalan=najmanji();
		if(minimalan==0){
			for(int j=i;j<k;j++)
			cout<<minimalan<<endl;
			break;
		}
		else{
			for(int j=0;j<n;j++){
				if(v[j]==0) continue;
				else{
					v[j]-=minimalan;
				}
			}
		}
		cout<<minimalan<<endl;
	}
	return 0;
}


/******************************************
--------***ID:ADNAN KISMETOVIC***----------
----***USER:kismetovic-codeforces.com***---
*******************************************/
#include <bits/stdc++.h>

using namespace std;

long long n,k,a,minimalan=1;
vector<long long> v;
int najmanji(){
	long long minimum=1000000000;
	for(int i=0;i<v.size();i++){
		if(v[i]==0) continue;
		else if(v[i]<=minimum){
			minimum=v[i];
		}
	}
	if(minimum<1000000000)
	return minimum;
	else return 0;
}
int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a;
		v.push_back(a);
	}
	for(int i=0;i<k;i++){
		if(*max_element(v.begin(),v.end())==0){
			cout<<0<<endl;
			continue;
		}
		if(minimalan==0){
			cout<<0<<endl;
			continue;
		}
		minimalan=najmanji();
		if(minimalan==0){
			cout<<0<<endl;
			continue;
		}
		cout<<minimalan<<endl;
		for(int j=0;j<n;j++){
			if(v[j]==0) continue;
			else{
				v[j]-=minimalan;
			}
		}
	}
	return 0;
}


/******************************************
--------***ID:ADNAN KISMETOVIC***----------
----***USER:kismetovic-codeforces.com***---
*******************************************/
#include <bits/stdc++.h>

using namespace std;

long long n,k,a[10000000],minimalan=0;

int najmanji(){
	sort(a,a+n);
	for(int i=0;i<n;i++){
		if(a[i]==0) continue;
		else{
			return a[i];
		}
	}
	return 0;
}

int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<k;i++){
		minimalan=najmanji();
		cout<<minimalan<<endl;
		for(int j=0;j<n;j++){
			if(a[j]==0) continue;
			else{
				a[j]-=minimalan;
			}
		//	cout<<a[j];
		}
	}
	return 0;
}


/******************************************
--------***ID:ADNAN KISMETOVIC***----------
----***USER:kismetovic-codeforces.com***---
*******************************************/
#include <bits/stdc++.h>

using namespace std;

long long n,k,a[100000000],minimalan=0;

int najmanji(){
	sort(a,a+n);
	if(max(a[0],a[n-1])==0) return 0;
	for(int i=0;i<n;i++){
		if(a[i]==0) continue;
		else{
			return a[i];
		}
	}
	return 0;
}

int smanji(){
	if(minimalan==0) return 0;
	for(int j=0;j<n;j++){
		if(a[j]==0) continue;
		else{
			a[j]-=minimalan;
		}
		//	cout<<a[j];
	}
}
int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<k;i++){
		minimalan=najmanji();
		if(minimalan==0){
			for(int j=i;j<k;j++)
			cout<<minimalan<<endl;
			break;
		}
		cout<<minimalan<<endl;
		smanji();
	}
	return 0;
}


#include <iostream>
#include <set>
using namespace std;
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    set<int> s;
    s.insert(0);
    while (n--)
    {
        int a;
        scanf("%d",&a);
        s.insert(a);
    }
    auto it=s.begin();
    for (int i=0;i<m;i++)
    {
        if (next(it)==s.end())
        printf("0\n");
        else
        {
            printf("%d\n",*next(it)-*it);
            it=next(it);
        }
    }
}


/******************************************
--------***ID:ADNAN KISMETOVIC***----------
----***USER:kismetovic-codeforces.com***---
*******************************************/
#include <bits/stdc++.h>

using namespace std;

long long n,k,a,minimalan=0;
vector<long long> v;

int najmanji(){
	long long minimum=1000000000;
	//if(max(v[0],v[n-1])==0) return 0;
	for(int i=0;i<v.size();i++){
		if(v[i]==0) continue;
		else if(v[i]<minimum){
			minimum=v[i];
		}
	}
	if(minimum<1000000000)
	return minimum;
	else return 0;
}

int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a;
		v.push_back(a);
	}
	for(int i=0;i<k;i++){
		minimalan=najmanji();
		if(minimalan==0){
			cout<<0<<endl;
			continue;
		}
		cout<<minimalan<<endl;
		for(int j=0;j<n;j++){
			if(v[j]==0) continue;
			else{
				v[j]-=minimalan;
			}
		}
	}
	return 0;
}


/******************************************
--------***ID:ADNAN KISMETOVIC***----------
----***USER:kismetovic-codeforces.com***---
*******************************************/
#include <bits/stdc++.h>

using namespace std;

long long n,k,a,minimalan=0;
vector<long long> v;

int najmanji(){
	long long minimum=100000000;
	if(max(v[0],v[n-1])==0) return 0;
	for(int i=0;i<v.size();i++){
		if(v[i]==0) continue;
		else if(v[i]<minimum){
			minimum=v[i];
		}
	}
	return minimum;
}

int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a;
		v.push_back(a);
	}
	for(int i=0;i<k;i++){
		minimalan=najmanji();
		if(minimalan==0){
			cout<<0<<endl;
			continue;
		}
		cout<<minimalan<<endl;
		for(int j=0;j<n;j++){
			if(v[j]==0) continue;
			else{
				v[j]-=minimalan;
			}
		}
	}
	return 0;
}


/******************************************
--------***ID:ADNAN KISMETOVIC***----------
----***USER:kismetovic-codeforces.com***---
*******************************************/
#include <bits/stdc++.h>

using namespace std;

long long n,k,a,minimalan=1;
vector<long long> v;

int najmanji(){
	long long minimum=1000000000;
	for(int i=0;i<v.size();i++){
		if(v[i]==0) continue;
		else if(v[i]<=minimum){
			minimum=v[i];
		}
	}
	if(minimum<1000000000)
	return minimum;
	else return 0;
}

int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a;
		v.push_back(a);
	}
	for(int i=0;i<k;i++){
		if(*max_element(v.begin(),v.end())==0){
			cout<<0<<endl;
			continue;
		}
		if(minimalan==0){
			cout<<0<<endl;
			continue;
		}
		minimalan=najmanji();
		if(minimalan==0){
			cout<<0<<endl;
			continue;
		}
		cout<<minimalan<<endl;
		for(int j=0;j<n;j++){
			if(v[j]==0) continue;
			else{
				v[j]-=minimalan;
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    long long int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    int l=0;
    for(int i=0;i<k;i++)
    {
        int flag=0;
        if(a[i]==0 && i<n)
            {
                k++;
                if(i+1>=k)
                {
                    cout<<0<<endl;
                    continue;

                }
                if(a[i+1]==l)
                    a[i+1]=0;
                continue;
            }
       else if(a[i]!=0 && i<n)
       {
        flag=1;
        cout<<a[i]-l<<endl;
        l=a[i];
         if(i+1>=k || i==n-1)
                {
                    //cout<<0<<endl;
                    continue;

                }
        if(a[i]==a[i+1])
        {
            a[i+1]=0;

            continue;
        }
        }
        if(flag==0)
            cout<<flag<<endl;

}
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    long long int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    int l=0;
    for(int i=0;i<k-1;i++)
    {
        int flag=0;
        if(a[i]==0 && i<n)
            {
                k++;
                if(a[i+1]==l)
                    a[i+1]=0;
                continue;
            }
       else if(a[i]!=0 && i<n)
       {
        flag=1;
        cout<<a[i]-l<<endl;
        l=a[i];
        if(a[i]==a[i+1])
        {
            a[i+1]=0;

            continue;
        }
        }
        if(flag==0)
            cout<<flag<<endl;

}
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    long long int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    int l=0;
    for(int i=0;i<k;i++)
    {
        int flag=0;
        if(a[i]==0 && i<n)
            {
                k++;
                if(i+1>=k)
                {
                    cout<<0<<endl;
                    continue;

                }
                if(a[i+1]==l)
                    a[i+1]=0;
                continue;
            }
       else if(a[i]!=0 && i<n)
       {
        flag=1;
        cout<<a[i]-l<<endl;
        l=a[i];
        if(a[i]==a[i+1])
        {
            a[i+1]=0;

            continue;
        }
        }
        if(flag==0)
            cout<<flag<<endl;

}
}


#include <iostream>
#include<stdio.h>
#include <set>
using namespace std;
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    set<int> s;
    s.insert(0);
    while (n--)
    {
    	int a;
    	scanf("%d",&a);
    	s.insert(a);
	}
	auto it=s.begin();
	for (int i=0;i<m;i++)
	{
		if (next(it)==s.end())
		printf("0\n");
		else
		{
			printf("%d\n",*next(it)-*it);
			it=next(it);
		}
	}
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    long long int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    int l=0;
    for(int i=0;i<k;i++)
    {
        int flag=0;
        if(a[i]==0 && i<n)
            {
                k++;
                if(a[i+1]==l)
                    a[i+1]=0;
                continue;
            }
       else if(a[i]!=0 && i<n)
       {
        flag=1;
        cout<<a[i]-l<<endl;
        l=a[i];
        if(a[i]==a[i+1])
        {
            a[i+1]=0;

            continue;
        }
        }
        if(flag==0)
            cout<<flag<<endl;

}
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    long long int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);

    for(int i=0;i<k;i++)
    {
        int flag=0;
        if(a[i]==0 && i<n)
            {
                k++;
                continue;
            }
        else if(a[i]!=0 && i<n)
        {
            flag=1;

            for(int j=i+1;j<n;j++)
            {
                a[j]=a[j]-a[i];
            }
            cout<<a[i]<<endl;
            a[i]=0;
        }
        if(flag==0)
            cout<<flag<<endl;

    }

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    long long int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    int l=0;
    for(int i=0;i<k;i++)
    {
        int flag=0;
        if(a[i]==0 && i<n)
            {
                k++;
                if(i+1>=k)
                {
                    cout<<0<<endl;
                    continue;

                }
                if(a[i+1]==l)
                    a[i+1]=0;
                continue;
            }
       else if(a[i]!=0 && i<n)
       {
        flag=1;
        cout<<a[i]-l<<endl;
        l=a[i];
         if(i+1>=k)
                {
                    //cout<<0<<endl;
                    continue;

                }
        if(a[i]==a[i+1])
        {
            a[i+1]=0;

            continue;
        }
        }
        if(flag==0)
            cout<<flag<<endl;

}
}


#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, k;
  cin >> n >> k;
  vector <int> a(n);
  for (int i = 0; i < n; ++i){
  	cin >> a[i];
  }
  sort(a.begin(), a.end());
  int cnt = 0;
  for (int i = 0; i < k; ++i){
  	if (a[i] == a[i - 1]){
  		++k;
  		continue;
  	}
  	if (i < n){
  		cout << a[i] - cnt << endl;
  		cnt = a[i];
  	}
  	else{
  		cout << 0 << endl;
  	}
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, k;
  cin >> n >> k;
  vector <int> a(n);
  for (int i = 0; i < n; ++i){
  	cin >> a[i];
  }
  sort(a.begin(), a.end());
  cout << a[0] << endl;
  for (int i = 1; i < k; ++i){
  	if (a[i] == a[i - 1]){
  		++k;
  		continue;
  	}
  	if (i < n){
  		cout << a[i] - a[i - 1] << endl;
  	}
  	else{
  		cout << 0 << endl;
  	}
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, k;
  cin >> n >> k;
  vector <int> a(n);
  for (int i = 0; i < n; ++i){
  	cin >> a[i];
  }
  sort(a.begin(), a.end());
  a.resize(1e5);
  int cnt = 0;
  for (int i = 0; i < k; ++i){
  	if (a[i] == a[i - 1]){
  		++k;
  		continue;
  	}
  	if (i < n){
  		cout << a[i] - cnt << endl;
  		cnt = a[i];
  	}
  	else{
  		cout << 0 << endl;
  	}
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, k;
  cin >> n >> k;
  vector <int> a(n);
  for (int i = 0; i < n; ++i){
  	cin >> a[i];
  }
  sort(a.begin(), a.end());
  int cnt = 0;
  for (int i = 0; i < k; ++i){
  	if (i < n && a[i] == a[i - 1]){
  		++k;
  		continue;
  	}
  	if (i < n){
  		cout << a[i] - cnt << endl;
  		cnt = a[i];
  	}
  	else{
  		cout << 0 << endl;
  	}
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, k;
  cin >> n >> k;
  vector <int> a(n);
  for (int i = 0; i < n; ++i){
  	cin >> a[i];
  }
  sort(a.begin(), a.end());
  int cnt = 0;
  for (int i = 0; i < k; ++i){
  	if (a[i] == a[i - 1] && i - 1 >= 0){
  		++k;
  		continue;
  	}
  	if (i < n){
  		cout << a[i] - cnt << endl;
  		cnt = a[i];
  	}
  	else{
  		cout << 0 << endl;
  	}
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, k;
  cin >> n >> k;
  vector <int> a(n);
  for (int i = 0; i < n; ++i){
  	cin >> a[i];
  }
  sort(a.begin(), a.end());
  int cnt = 0;
  for (int i = 0; i < k; ++i){
  	if (a[i] == a[i - 1]){
  		++k;
  		continue;
  	}
  	if (i < n){
  		cout << a[i] - a[i - 1] << endl;
  	}
  	else{
  		cout << 0 << endl;
  	}
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, k;
  cin >> n >> k;
  vector <int> a(1e5);
  for (int i = 0; i < n; ++i){
  	cin >> a[i];
  }
  sort(a.begin(), a.end());
  int cnt = 0;
  for (int i = 0; i < k; ++i){
  	if (a[i] == a[i - 1]){
  		++k;
  		continue;
  	}
  	if (i < n){
  		cout << a[i] - cnt << endl;
  		cnt = a[i];
  	}
  	else{
  		cout << 0 << endl;
  	}
  }
  return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#include <string>

using namespace std;

int main()
{
	long int n,k,i,j,l;
	cin >> n>>k;
	vector< long long int > a;
	long long int min,u;
	for(i=0;i<n;i++)
	{
		cin >> u;
		a.push_back(u);
	}
	sort(a.begin(),a.end());
	for(i=0;i<k;i++)
	{	min=0;
		if(a[n-1]==0)
		{
			cout <<0<<endl;continue;
		}
		for(j=0;j<n;j++)
		{
			if(a[j]!=0)
			{
				min=a[j];break;
			}

		}

		cout <<min<<endl;
		if(min!=0)
			for(l=j;l<n;l++)
				a[l]-=min;
	}
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#include <string>

using namespace std;
typedef long long ll;
typedef vector< long long > vi;
typedef set< long long > si;
typedef pair< long long, long long > pairs;
#define sz(a)           ll((a).size())
#define pb              push_back
#define mp				make_pair
#define all(c)          (c).begin(),(c).end()
#define rev(c) 			(c).rbegin(),(c).rend()
#define endl 			"\n"
#define rep(i,a,b) 		for(ll i=a;i<b;i++)
#define fr(n) 			for(ll i=0;i<n;i++)
#define tr(a) 			for(auto it=a.begin();it!=a.end();it++)
#define present(c, x) 	(c.find(x) != c.end())
#define N 				1000000007
#define PI 				3.1415926535897932384
#define F 				first
#define S 				second
#define FAST 			ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

void solve()
{
	ll n,k,a;
	cin>>n>>k;
	si s;
	s.insert(0);
	fr(n)
	{
		cin>>a;
		s.insert(a);
	}
	auto it=s.begin();
	while(k--)
	{
		if(next(it) == s.end())
			cout<<0<<endl;
		else
		{
			cout<<*next(it) - *it<<endl;it++;
		}

	}
}

int main()
{
	//cout<<fixed<<setprecision(15);
	FAST
	ll test;
	test=1;
	//cin>>test;
	while(test--)
	{
		solve();
	}
	return 0;
}