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