#include <bits/stdc++.h>
using namespace std;
int a[11111], b[11111];
int j, i, a4, a7;
int main() {
  int m, k, n, z;
  cin >> n >> k;
  for (i = 1; i < n; i++) a[i] = b[i] = 1;
  for (i = 0; i < k; i++) {
    for (j = 1; j <= n; j++) {
      for (z = n; z > 0; z--)
        if (b[j] + a[z] == n - j) break;
      if (z == 0) z++;
      b[j] = b[j] + a[z];
      cout << z << ' ';
    }
    cout << endl;
    for (j = 1; j <= n; j++) a[j] = b[j];
  }
}
