#include <bits/stdc++.h>
int n, k;
int goal[11111], cur[11111];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    goal[i] = n - i - 1;
    cur[i] = 1;
  }
  cur[n - 1] = 0;
  for (int i = 0; i < k; i++)
    for (int j = 0; j < n; j++) {
      if ((1 << i) & (goal[j] ^ cur[j])) {
        cur[j] += (1 << i);
        printf("%d", n - (1 << i));
      } else
        printf("%d", n);
      printf("%c", j < n - 1 ? ' ' : '\n');
    }
  return 0;
}
