#include <bits/stdc++.h>
using namespace std;
const int max_proc = 10001;
int memory[max_proc], proc[max_proc];
int n;
int main() {
  int k;
  cin >> n >> k;
  for (int i = 1; i < n; ++i) memory[i] = 1;
  memory[n] = 0;
  proc[n] = proc[n - 1] = n;
  for (int step = 1; step <= k; ++step) {
    for (int i = 1; i <= n - step; ++i) {
      if (memory[i] * 2 <= n - i) {
        proc[i] = i;
        memory[i] *= 2;
      } else {
        proc[i] = i + memory[i];
        memory[i] += memory[i + memory[i]];
      }
    }
    for (int i = 1; i <= n; ++i) {
      cout << proc[i] << " ";
    }
    cout << endl;
  }
  return 0;
}
