#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int cur[n + 2];
  for (int i = 1; i < n; i++) cur[i] = 1;
  cur[n] = 0;
  for (int it = 0; it < k; it++) {
    for (int i = 1; i <= n; i++) {
      if (cur[i] * 2 <= n - i) {
        printf("%d ", i);
        cur[i] <<= 1;
      } else {
        printf("%d ", n - (n - i - cur[i]));
        assert(cur[n - (n - i - cur[i])] == (n - i - cur[i]));
        cur[i] = n - i;
      }
    }
    printf("\n");
  }
  return 0;
}
