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