program sort;
var n,c,ct:int64;
    i,j:integer;
    a,x,b:array[1..1002]of longint;
begin
     readln(n,c);
     for i:=1 to n do
         begin
              read(a[i]);
              b[i]:=1;
         end;
     for i:=1 to n-1 do
         for j:=i+1 to n do
              if (a[i]>a[j]) then
                 begin
                      a[i]:=a[i]-a[j];
                      a[j]:=a[i]+a[j];
                      a[i]:=a[j]-a[i];
                 end;
     ct:=1;
     a[n+1]:=c+1;
     for i:=2 to n+1 do
              if a[i]<>a[i-1] then
                 begin
                      x[ct]:=a[i-1];
                      ct:=ct+1;
                 end
              else
              if a[i]=a[i-1] then b[ct]:=b[ct]+1;
     for i:=1 to ct-1 do
         for j:=i+1 to ct-1 do
             if (b[i]<b[j]) then
                 begin
                      b[i]:=b[i]-b[j];
                      b[j]:=b[i]+b[j];
                      b[i]:=b[j]-b[i];
                      x[i]:=x[i]-x[j];
                      x[j]:=x[i]+x[j];
                      x[i]:=x[j]-x[i];
                 end;
     for i:=1 to ct-1 do
         for j:=1 to b[i] do write(x[i],' ');
     readln(j);
end.

