#include <bits/stdc++.h>
using namespace std;
int n, k, a[10005], pos[10005], now[10005];
void load() { cin >> n >> k; }
void solve() {
  for (int i = 0; i < n - 1; i++) {
    a[i] = 1;
  }
  pos[0] = n;
  pos[1] = n - 1;
  int mx = 1;
  for (int step = 0; step < k; step++) {
    int nmx = mx;
    for (int i = n - 1; i >= 0; i--) {
      int need = n - i - 1;
      if (need == a[i]) {
        now[i] = pos[0];
        continue;
      }
      if (need - mx <= a[i]) {
        now[i] = pos[need - a[i]];
        a[i] = need;
        nmx = max(nmx, need);
        pos[a[i]] = i + 1;
      } else {
        now[i] = pos[mx];
        a[i] += mx;
      }
    }
    mx = nmx;
    for (int i = 0; i < n; i++) {
      printf("%d ", now[i]);
    }
    printf("\n");
  }
}
int main() {
  load();
  solve();
  return 0;
}
