#include <bits/stdc++.h>
using namespace std;
int data[2][10001], ptr[10001];
int main() {
  int n, k, p, q, r, t = 0;
  cin >> n >> k;
  for (int i = 1; i < n; i++) {
    data[t][i] = 1;
    ptr[i] = 1;
  }
  ptr[n] = 1;
  for (p = 0; p < k; p++) {
    for (q = 1; q <= n; q++) {
      for (r = ptr[q]; r <= n; r++) {
        if (data[t][q] + data[t][r] <= n - q) {
          cout << r << " ";
          data[1 - t][q] = data[t][q] + data[t][r];
          ptr[q] = r;
          break;
        }
      }
    }
    cout << endl;
    t = 1 - t;
  }
  return 0;
}
