#include <bits/stdc++.h>
using namespace std;
vector<int> vec;
int print[32][200000];
int main() {
  int n, k;
  cin >> n >> k;
  vec.resize(n);
  for (int i = 0; i < (int)n; i++) vec[i] = 1;
  vec[n - 1] = 0;
  for (int i = 0; i < (int)k; i++) {
    for (int j = 0; j < (int)n; j++) {
      print[i][j] = n;
      if (vec[j] < (n - (j + 1))) {
        int a = n - (j + 1) - vec[j];
        int b = n - a;
        print[i][j] = b;
      }
    }
    for (int j = 0; j < (int)n; j++) vec[j] += vec[print[i][j] - 1];
  }
  for (int i = 0; i < (int)k; i++) {
    for (int j = 0; j < (int)n - 1; j++) printf("%d ", print[i][j]);
    cout << print[i][n - 1] << endl;
  }
}
