const
  maxn = 100000;
type
  integer = longint;
  tarr = array[1..maxn] of integer;
var
  i, j, n, k : integer;
  a : tarr;

function bad(var a : tarr; n : integer): boolean;
begin
  bad := false;
  for i := 1 to n do begin
    if (a[i] = i) then begin
      bad := true;
      break;
    end;
  end;
end;

procedure shuffle(var a : tarr; n : integer);
var
  t, j : integer;
begin
  for i := 2 to n do begin
    j := random(i) + 1;
    t := a[i]; a[i] := a[j]; a[j] := t;
  end;
end;

begin
  assign(input, 'haircut.in');
  assign(output, 'haircut.out');
  reset(input);
  rewrite(output);
  read(n, k);
  randseed := 25566;
  for i := 1 to k do begin
    for j := 1 to n div k do begin
      a[(i - 1) * (n div k) + j] := i;
    end;
  end;
  for i := n div k * k + 1 to n do begin
    a[i] := i - n div k * k;
  end;
  while bad(a, n) do begin
    shuffle(a, n);
  end;
  for i := 1 to n do begin
    write(a[i], ' ');
  end;
end.