#include <bits/stdc++.h>
int main() {
  int n, k, i, j = 0, m, c;
  scanf("%d %d", &n, &k);
  m = n - 1;
  short *a = new short[n];
  for (i = 0; i < n; i++) a[i] = 1;
  a[m] = 0;
  for (i = 0; i < k; j = 0, puts(""), i++)
    for (c = 0; c < n; c++) {
      if (j < c) j = c;
      while (a[c] + a[j] > m - c) j++;
      printf("%d ", j + 1);
      a[c] += a[j];
    }
  return 0;
}
