#include <bits/stdc++.h>
using namespace std;
int n, k, lasta[10005], a[10005];
struct node {
  int num, w;
} b[10005];
int find(int now) {
  int l = 1, r = n;
  for (int mid = (l + r >> 1); l < r; mid = (l + r >> 1))
    if (b[mid].w < now)
      l = mid + 1;
    else
      r = mid;
  while (b[l].w > now) l--;
  return b[l].num;
}
bool cmp(node u, node v) { return u.w < v.w; }
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i < n; i++) a[i] = 1;
  a[n] = 0;
  for (int t = 1; t <= k; t++) {
    for (int i = 1; i <= n; i++) {
      b[i].num = i;
      b[i].w = a[i];
      lasta[i] = a[i];
    }
    sort(b + 1, b + n + 1, cmp);
    for (int i = 1; i <= n; i++) {
      int tmp = find(n - i - a[i]);
      printf("%d ", tmp);
      a[i] = a[i] + lasta[tmp];
    }
    printf("\n");
  }
  return 0;
}
