program KonteinerisJ;
  const Ck = 100;
        PRF = 'KONTEIN.IN';
        RZF = 'KONTEIN.OUT';        
  type TMas = array[0..Ck] of integer;
  
var fd : text;
    n, g : integer;
    K : TMas;  
    i, sk, r, kk : integer;
begin
  for i := 1 to Ck do K[i] := 0;
  Assign(fd, PRF);  Reset(fd);
  ReadLn(fd, n, g);
  for i := 1 to n do begin
    Read(fd, sk);
    K[g] := K[g] + sk div g;
    r := sk mod g;
    K[r] := K[r] + 1;
  end;
  Close(fd);
  
  sk := 0;
  for i := 1 to g do 
    sk := sk + K[i];
  
  Assign(fd, RZF); Rewrite(fd);
  WriteLn(fd, sk);
  for i := g downto 1 do WriteLn(fd, K[i]);
  Close(fd);
end.
