#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, f, p;
  cin >> n >> k;
  int r[n + 1], tem[n + 1];
  int i, j;
  memset(r, 1, sizeof(r));
  r[n] = 0;
  for (i = 0; i < k; i++) {
    f = n;
    p = (int)pow(2, i);
    for (j = n; j > n - p; j--) tem[j] = n;
    for (j = n - p; j >= 1; j--) {
      tem[j] = f;
      r[j] += r[f];
      f--;
    }
    for (j = 1; j <= n; j++) cout << tem[j] << " ";
    cout << "\n";
  }
  return 0;
}
