#include <bits/stdc++.h>
using namespace std;
int a[25][10005];
int n, k;
inline int findp(int pos, int val, int z) {
  int i;
  for (i = pos; i <= n && a[z][i] > val; i++)
    ;
  return i;
}
int main() {
  int i, j, p;
  scanf("%d%d", &n, &k);
  for (i = 0, j = 1; j <= n; j++) a[i][j] = 1;
  a[0][n] = 0;
  for (i = 1; i <= k; i++) {
    for (j = 1; j < n; j++) {
      p = findp(j + 1, (n - j) - a[i - 1][j], i - 1);
      a[i][j] = a[i - 1][j] + a[i - 1][p];
      printf("%d ", p);
    }
    printf("%d\n", n);
  }
}
