#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10000;
const int MAXK = 20;
int V[MAXK + 3][MAXN + 3], Ans[MAXK + 3][MAXN + 3];
int main() {
  V[0][1] = 0;
  for (int j = 2; j <= MAXN; j++) {
    V[0][j] = 1;
  }
  for (int i = 1; i <= MAXK; i++) {
    int k = 1;
    for (int j = 1; j <= MAXN; j++) {
      if (k < MAXN && V[i - 1][k] < V[i - 1][k + 1] &&
          V[i - 1][j] + V[i - 1][k] < j - 1)
        k++;
      V[i][j] = V[i - 1][j] + V[i - 1][k];
      Ans[i][j] = k;
    }
  }
  int N, K;
  while (~scanf("%d%d", &N, &K)) {
    for (int i = 1; i <= K; i++) {
      for (int j = N; j > 1; j--) printf("%d ", N - Ans[i][j] + 1);
      printf("%d\n", N - Ans[i][1] + 1);
    }
  }
  return 0;
}
