#include <bits/stdc++.h>
using namespace std;
int a[10010];
int main() {
  int n, m;
  while (scanf("%d%d", &n, &m) == 2) {
    for (int i = 1; i < n; i++) a[i] = 1;
    a[n] = 0;
    int maxx = 1;
    for (int ii = 0; ii < m; ii++) {
      for (int i = 1; i <= n; i++) {
        if (a[i] + maxx <= n - i) {
          printf("%d ", n - maxx);
          a[i] += maxx;
        } else {
          printf("%d ", i + a[i]);
          a[i] = n - i;
        }
      }
      puts("");
      maxx *= 2;
    }
  }
  return 0;
}
