#include <bits/stdc++.h>
using namespace std;
const int inf = int(1e9);
const double eps = 1e-9;
const double pi = 4 * atan(double(1));
int a[10100], na[10100], b[10100];
inline bool myassert(bool fl) {
  if (!fl) {
    while (true)
      ;
  }
}
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n - 1; i++) {
    a[i] = 1;
  }
  for (int i = 0; i < k; i++) {
    int ptr = n - 1;
    for (int j = n - 1; j >= 0; j--) {
      while (ptr > 0 && a[j] + a[ptr - 1] <= n - j - 1) {
        ptr--;
      }
      b[j] = ptr;
    }
    for (int j = 0; j < n; j++) {
      printf("%d ", b[j] + 1);
      na[j] = a[j] + a[b[j]];
    }
    printf("\n");
    for (int j = 0; j < n; j++) {
      a[j] = na[j];
    }
  }
  for (int i = 0; i < n; i++) {
    myassert(a[i] == n - i - 1);
  }
  return 0;
}
