#include <bits/stdc++.h>
const int MAXN = 1e4 + 10;
using namespace std;
int N, K;
int sol[30][MAXN];
int main() {
  scanf("%d %d", &N, &K);
  for (int c = 1; c < N; c++) {
    int a = N - c >> 1, b = 1;
    while (a) {
      sol[b++][c] = c;
      a >>= 1;
    }
    a = N - c;
    int keep = 0;
    for (int d = b - 2; d >= 0; d--) {
      if (a & (1 << d)) keep |= 1 << d;
    }
    sol[b][c] = N - keep;
  }
  for (int c = 1; c <= K; c++) {
    for (int d = 1; d <= N; d++) printf("%d ", sol[c][d] == 0 ? N : sol[c][d]);
    printf("\n");
  }
}
