program treci;

var br,i,j,n:integer;
        broj,k:longint;
        tab:array[1..2,1..1000] of longint;
        pri:array[1..2,1..1] of longint;
        pro:boolean;

begin

        readln(n,k);

        br:=0;
        pro:=false;

        for i:=1 to n do
        begin
                tab[1,i]:=0;
                tab[2,i]:=0;
        end;

        for i:=1 to n do
        begin
                read(broj);
                pro:=false;

                for j:=1 to n do
                begin
                        if tab[1,j]=broj then
                        begin
                                tab[2,j]:=tab[2,j]+1;
                                pro:=true;
                        end;
                end;
                        if pro=false then
                        begin
                                br:=br+1;
                                tab[1,br]:=broj;
                                tab[2,br]:=1;
                        end;
        end;



        for i:=br-1 downto 1 do
        begin
                for j:=1 to i do
                begin
                        if tab[2,j] < tab[2,j+1] then
                        begin
                                pri[1,1]:=tab[1,j];
                                pri[2,1]:=tab[2,j];
                                tab[2,j]:=tab[2,j+1];
                                tab[1,j]:=tab[1,j+1];
                                tab[2,j+1]:=pri[2,1];
                                tab[1,j+1]:=pri[1,1];
                        end;
                end;
        end;

        for i:=1 to br do
        begin
                for j:=1 to tab[2,i] do write(tab[1,i],' ');
        end;
end.