#include <bits/stdc++.h>
using namespace std;
int n, k;
int oldmem[10010];
int newmem[10010];
bool ok[10010];
int procinc(int pos) {
  int respos = 1;
  while (oldmem[pos] + oldmem[respos++] > n - pos)
    ;
  newmem[pos] += oldmem[--respos];
  if (newmem[pos] == n - pos) ok[pos] = 1;
  return respos;
}
bool isok() {
  bool res = true;
  for (int i = 1; i <= n; i++) res = res && ok[i];
  return res;
}
int main() {
  cin >> n >> k;
  ok[n] = 1;
  for (int i = 1; i < n; i++) {
    oldmem[i] = 1;
    newmem[i] = 1;
  }
  int iter = 0;
  while (!isok()) {
    for (int i = 1; i < n; i++) printf("%d ", procinc(i));
    for (int i = 1; i < n; i++) oldmem[i] = newmem[i];
    printf("%d\n", n);
    iter++;
  }
  for (int i = iter; i < k; i++) {
    for (int i = 0; i < n; i++) printf("%d ", n);
    printf("\n");
  }
  return 0;
}
