#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> val(n, 1);
  val[0] = 0;
  for (int j = 0; j < k; ++j) {
    vector<int> nw;
    vector<int> op;
    for (int i = 0; i < n; ++i) {
      int index = lower_bound(val.begin(), val.end(), i - val[i]) - val.begin();
      while (index >= 0 && val[index] > i - val[i]) {
        index--;
      }
      if (index == n) index = n - 1;
      nw.push_back(val[i] + val[index]);
      op.push_back(n - index);
    }
    reverse(op.begin(), op.end());
    for (int i = 0; i < n; ++i) {
      if (i) cout << ' ';
      cout << op[i];
    }
    cout << endl;
    val = nw;
  }
  return 0;
}
