#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-12;
const int INF = 999999999;
int n, k;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= k; ++i) {
    int p = 1 << i;
    for (int j = 1; j < n; ++j) {
      int v = n - j;
      int res = n;
      if (p <= v)
        res = j;
      else if (p > v && (p >> 1) < v) {
        res = n - (v - (p >> 1));
      }
      printf("%d ", res);
    }
    printf("%d\n", n);
  }
  return 0;
}
