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