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