#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int l1 = 2, l2 = 1;
  for (int r = 0; r < k; r++) {
    vector<int> v;
    l1 = min(l1, n);
    l2 = min(n - l1, l2);
    for (int i = 0; i < l1; i++) v.push_back(n);
    for (int i = 0; i < l2; i++) v.push_back(n - i - 1);
    for (int i = 0; i < n - l1 - l2; i++) v.push_back(n - l2);
    for (int i = v.size() - 1; i >= 0; i--) {
      if (i < v.size() - 1) cout << " ";
      cout << v[i];
    }
    cout << endl;
    l1 = 2 * (l1 - 1) + 1, l2 *= 2;
  }
}
