#include <bits/stdc++.h>
int tmp[100100], a[100100];
int n, req;
void cal(int curr, int rem);
int main() {
  int i, j, k, l, test, t = 1;
  scanf("%d %d", &n, &req);
  cal(n - 1, req);
  return 0;
}
void cal(int curr, int rem) {
  int i, j;
  if (!rem) return;
  if (curr <= 1) {
    for (i = 1; i <= n; i++) {
      if (i > 1) printf(" ");
      printf("%d", n);
    }
    printf("\n");
    cal(curr, rem - 1);
    return;
  }
  int now = n - curr;
  int space = 0;
  int n_curr = n - (2 * now);
  for (i = 1; i < n_curr; i++) {
    if (space) printf(" ");
    space = 1;
    printf("%d", curr);
  }
  for (i = n_curr, j = curr; i < curr; i++, j++) {
    if (i < 1) continue;
    if (space) printf(" ");
    space = 1;
    printf("%d", j);
  }
  for (i = curr; i <= n; i++) {
    if (i < 1) continue;
    if (space) printf(" ");
    space = 1;
    printf("%d", n);
  }
  printf("\n");
  cal(n_curr, rem - 1);
}
