#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  int n, m, i, j, k, l;
  scanf("%d", &n);
  scanf("%d", &k);
  for (i = 1; i < n; i++) a[i] = 1;
  for (j = 1; j <= k; j++) {
    for (i = 1; i <= n; i++) {
      if (2 * a[i] <= n - i)
        printf("%d ", i), a[i] = 2 * a[i];
      else
        printf("%d ", n - (n - i - a[i])), a[i] = n - i;
    }
    printf("\n");
  }
  return 0;
}
