var
  n,k,br,x,i,j,p,g:integer;
  a:array[1..10000] of integer;
  b:array[1..10000] of integer;
begin
  readln(n,k);
  br:=0;
  j:=0;
  for i:=0 to (2*n+1) do
  a[i]:=0;
  for i:=0 to (n+1) do
  begin
  readln(x);
  a[x+n]:=a[x+n]+1;
  end;
  for i:=0 to (2*n+1) do
  begin
   if (a[i]<>0) and (a[i]>=k) then
   begin
     br:=br+1;
     b[j]:=i-n;
     j:=j+1;
   end;
  end;
  writeln(br);
  g:=j+1;
  for i:=1 to g do
  writeln(b[i]);
end.