#include <bits/stdc++.h>
using namespace std;
vector<int> a;
int lowerBound(int x, int l, int r) {
  if (l == r) {
    return l;
  }
  int m = (l + r) / 2;
  if (x > a[m]) {
    return lowerBound(x, l, m);
  }
  return lowerBound(x, m + 1, r);
}
int main() {
  int n, k;
  cin >> n >> k;
  a.resize(n);
  vector<int> c(n);
  for (int i = 0; i < n - 1; ++i) {
    a[i] = 1;
  }
  a[n - 1] = 0;
  for (int t = 0; t < k; ++t) {
    for (int i = 0; i < n; ++i) {
      c[i] = lowerBound(n - i - a[i], 0, n - 1);
    }
    vector<int> temp = a;
    for (int i = 0; i < n; ++i) {
      cout << c[i] + 1 << ' ';
      temp[i] += a[c[i]];
    }
    cout << endl;
    a = temp;
  }
  return 0;
}
