#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> val(n + 1);
  for (int i = 1; i < n; ++i) val[i] = n - i - 1;
  val[n] = 0;
  for (int i = 0; i < k; ++i) {
    for (int j = 1; j <= n; ++j) {
      int c = n;
      if (val[j] & (1 << i)) {
        c = n - (1 << i);
        val[j] ^= (1 << i);
      }
      cout << c << " ";
    }
    cout << endl;
  }
  return 0;
}
