#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10001;
int n, k;
int a[MAXN * 2];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i < n; i++) a[i] = 1;
  for (; k; k--) {
    for (int i = 1; i < n; i++) {
      int ans = i + 1;
      if (a[i] + a[i + 1] > (n - i)) ans = n - (n - i - a[i]);
      a[i] += a[ans];
      printf("%d ", ans);
    }
    printf("%d\n", n);
  }
  return 0;
}
