var n,i,j,p,z,x,br,max:integer;
    a: array [1..1000] of integer;
    b: array [1..1000] of integer;
    c: array [1..1000] of integer;
begin
    readln (n,p);
    max:=0;
    x:=0;
    for i:=1 to n do read(a[i]);
    for i:=1 to n do b[i]:=0;
    for i:=1 to n do
    begin
    for j:=1 to n do
      if a[i]=b[j] then begin
      x:=x+1;
      c[j]:=c[j]+1;
      end;
    if x=0 then begin
    b[i]:=a[i];
    c[i]:=1;
    end;
     x:=0;
    end;
    for i:=1 to n do
    begin
    for j:=1 to n do
    if c[j]>max then begin
    max:=c[j];
    br:=j;
    z:=b[j];
    end;
    for j:=1 to max do
    write (z,' ');
    c[br]:=0;
    max:=0;
    z:=0;
    end;
end.
