#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int _inf = 0xc0c0c0c0;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long _INF = 0xc0c0c0c0c0c0c0c0;
const long long mod = (int)1e9 + 7;
const int N = 1e4 + 100;
int op[30][N];
int need[N], a[N], aa[N];
void Find(int& x, int v) {
  while (a[x] > v) {
    ++x;
  }
}
int Ac() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i < n; ++i) {
    a[i] = 1;
    need[i] = n - i - 1;
  }
  for (int _k = 1; _k <= k; ++_k) {
    int b = 1;
    for (int i = 1; i <= n; ++i) {
      Find(b, need[i]);
      op[_k][i] = b;
      aa[i] = a[b];
    }
    for (int i = 1; i <= n; ++i) {
      a[i] += aa[i];
      need[i] -= aa[i];
    }
  }
  for (int i = 1; i <= k; ++i) {
    for (int j = 1; j <= n; ++j) {
      printf("%d%c", op[i][j], " \n"[j == n]);
    }
  }
  return 0;
}
int main() {
  Ac();
  return 0;
}
