#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int inf = (int)1e9;
const double eps = 1e-3;
const int ss = (int)1e6 + 3;
const int base = inf;
bool pred(const pair<int, int>& i, const pair<int, int>& j) {
  if (i.first == j.first)
    return i.second > j.second;
  else
    return i.first > j.first;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> proc(n + 1, 1);
  vector<int> moves(n + 1, 0);
  vector<int> copy(n + 1, 0);
  proc[n] = 0;
  for (int j = 0; j < k; ++j) {
    int x = 1 << j;
    for (int i = 1; i < n + 1; ++i) {
      if (proc[i] < n - i) {
        if (n - i - proc[i] <= x) {
          moves[i] = i + proc[i];
        } else {
          moves[i] = n - x;
        }
      } else {
        moves[i] = n;
      }
    }
    for (int i = 1; i < n + 1; ++i) {
      printf("%d ", moves[i]);
      copy[i] = proc[moves[i]];
    }
    cout << endl;
    for (int i = 1; i < n + 1; ++i) {
      proc[i] += copy[i];
    }
  }
  return 0;
}
