#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  int v[2][10000];
  for (int i = 0; i < n; i++) v[0][i] = 1;
  v[0][n - 1] = 0;
  int a, b, c;
  for (int i = 0; i < k; i++) {
    a = i % 2;
    b = (i + 1) % 2;
    c = 0;
    while (c < n - 1 && v[a][c] == v[a][c + 1]) c++;
    for (int j = 0; j < n; j++) {
      while (c < n - 1 && v[a][j] + v[a][c] > n - j - 1) c++;
      v[b][j] = v[a][j] + v[a][c];
      printf("%d%s", c + 1, (j == n - 1 ? "\n" : " "));
    }
  }
  return 0;
}
