#include <bits/stdc++.h>
int stp[25][10005];
int main() {
  int n, m, i, j, k, num[20];
  scanf("%d%d", &n, &k);
  for (i = 2, num[0] = num[1] = 1; i <= 14; i++) num[i] = 2 * num[i - 1];
  for (i = 1; i <= k; i++) {
    for (j = 1; j <= n; j++) stp[i][j] = n;
  }
  for (i = 1; i <= n - 2; i++) {
    m = n - i - 1;
    while (m) {
      for (j = 14; j >= 1; j--) {
        if (num[j] <= m) break;
      }
      stp[j][i] = n - num[j];
      m -= num[j];
    }
  }
  for (i = 1; i <= k; i++) {
    for (j = 1; j <= n; j++) {
      if (j != 1) printf(" ");
      printf("%d", stp[i][j]);
    }
    printf("\n");
  }
  return 0;
}
