#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int n, k;
int d[2][10000];
void solution() {
  scanf("%d %d", &n, &k);
  for (int i = 0, _n = (n - 1); i < _n; ++i) d[0][i] = 1;
  int cur = 0, nxt = 1;
  for (int it = 0, _n = (k); it < _n; ++it) {
    for (int i = 0, _n = (n); i < _n; ++i) {
      int need = n - i - 1 - d[cur][i];
      int lo = 0, hi = n - 1;
      while (hi - lo > 1) {
        int m = (lo + hi) / 2;
        if (d[cur][m] <= need)
          hi = m;
        else
          lo = m;
      }
      if (lo < hi && d[cur][lo] <= need) hi = lo;
      if (d[cur][hi] > need) throw 1;
      d[nxt][i] = d[cur][i] + d[cur][hi];
      printf("%d ", hi + 1);
    }
    swap(cur, nxt);
    puts("");
  }
  for (int i = 0, _n = (n); i < _n; ++i)
    if (d[cur][i] != n - i - 1) throw 1;
}
int main() {
  solution();
  return 0;
}
