#include <bits/stdc++.h>
using namespace std;
int N, K;
int val[10010], nval[10010], pos[10010], buf[10010];
int main() {
  scanf("%d%d", &N, &K);
  for (int i = 0; i < N - 1; ++i) val[i] = 1;
  int br = 0;
  for (;;) {
    for (int i = 0; i < N; ++i) pos[i] = -1, nval[i] = val[i];
    for (int i = N - 1; i >= 0; --i)
      if (pos[val[i]] == -1) pos[val[i]] = i;
    if (pos[N - 1] != -1) break;
    ++br;
    for (int i = N - 1; i >= 0; --i) {
      int tar = N - 1 - i;
      if (val[i] == tar)
        buf[i] = N - 1;
      else {
        if (pos[tar - val[i]] != -1)
          buf[i] = pos[tar - val[i]], nval[i] = tar;
        else
          buf[i] = buf[i + 1], nval[i] += val[buf[i]];
      }
    }
    for (int i = 0; i < N; ++i)
      printf("%d%c", buf[i] + 1, (i + 1 == N ? '\n' : ' '));
    for (int i = 0; i < N; ++i) val[i] = nval[i];
  }
  while (br < K) {
    ++br;
    for (int i = 0; i < N; ++i) printf("%d%c", N, (i + 1 == N ? '\n' : ' '));
  }
  return 0;
}
