#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T abs(T a) {
  return a < 0 ? (-a) : a;
}
template <typename T>
inline T sqr(T x) {
  return x * x;
}
int main() {
  int n, k;
  cin >> n >> k;
  {
    vector<int> v(n, 1);
    v[n - 1] = 0;
    for (int p = 0; p < (k); ++p) {
      int cur = 0;
      for (int i = 0; i < (n); ++i) {
        cur = max(cur, i);
        while (v[cur] > (n - i - 1) - v[i]) ++cur;
        v[i] += v[cur];
        cout << cur + 1 << " ";
      }
      cout << endl;
    }
    for (int i = 0; i < (n); ++i) {
      if (v[i] != (n - i - 1)) {
        cerr << "trololo" << endl;
        exit(1);
      }
    }
  }
  return 0;
}
