#include <bits/stdc++.h>
int min(int a, int b) {
  if (a <= b)
    return a;
  else
    return b;
}
int main() {
  int n, k, i, j, cur;
  scanf("%d", &n);
  scanf("%d", &k);
  cur = 1;
  for (i = 0; i < k; i++) {
    if (cur >= n - 1) {
      for (j = 1; j <= n; j++) {
        printf("%d ", n);
      }
      printf("\n");
    } else {
      for (j = 1; j < n - cur * 2; j++) {
        printf("%d ", n - cur);
      }
      for (j = min(cur, n - cur - 1); j >= 1; j--) {
        printf("%d ", n - j);
      }
      for (j = cur + 1; j >= 1; j--) {
        printf("%d ", n);
      }
      printf("\n");
      cur *= 2;
    }
  }
}
