#include <bits/stdc++.h>
using namespace std;
const string filename("");
vector<int> a[10010];
int n, k;
int solve() {
  if (!(cin >> n >> k)) return 1;
  for (int i = 0; i < int(2); ++i) a[i].clear();
  for (int i = 2; i < n; ++i) {
    int d1 = a[i >> 1].size(), d2 = a[(i + 1) >> 1].size();
    if (d1 > d2) {
      a[i] = a[i >> 1];
      a[i].push_back((i + 1) >> 1);
    } else {
      a[i] = a[(i + 1) >> 1];
      a[i].push_back(i >> 1);
    }
  }
  for (int j = 0; j < int(k); ++j) {
    for (int i = n - 1; i > 0; --i) {
      printf("%d\t", (j >= (int)a[i].size()) ? n : n - a[i][j]);
    }
    printf("%d\n", n);
  }
  return 0;
}
int main() {
  solve();
  return 0;
}
