#include <bits/stdc++.h>
using namespace std;
const int maxn = 10000 + 10;
int a[maxn], aim[maxn], num[maxn], command[maxn];
int n, k, step, now;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) aim[i] = n - i;
  for (int i = 1; i <= n - 1; i++) a[i] = 1;
  num[1] = n - 1;
  num[0] = n;
  now = 1;
  while (k) {
    k--;
    for (int i = 1; i <= n; i++) {
      if (num[aim[i] - a[i]] == 0) {
        a[i] = a[i] + now;
        command[i] = num[now];
      } else {
        command[i] = num[aim[i] - a[i]];
        a[i] = aim[i];
      }
    }
    for (int i = n; i; i--) {
      if (num[a[i]] == 0) num[a[i]] = i;
    }
    for (int i = 1; i <= n; i++) {
      printf("%d ", command[i]);
    }
    printf("\n");
    now *= 2;
  }
  return 0;
}
