#include <bits/stdc++.h>
using namespace std;
const int MN = 10000 + 10;
int arr[MN], mem[MN], cur[MN];
int bfind(int lf, int rg, int need) {
  int ans = rg;
  while (lf <= rg) {
    int mid = (lf + rg) / 2;
    if (need - arr[mid] < 0)
      lf = mid + 1;
    else {
      if (need - arr[mid] == 0) ans = mid;
      rg = mid - 1;
    }
  }
  return ans;
}
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i < n; i++) arr[i] = 1;
  for (int i = 1; i <= k; i++) {
    for (int j = n; j > 0; j--) {
      int need = n - j;
      if (arr[j] == need)
        cur[j] = n;
      else if (arr[j] + arr[1] <= need)
        cur[j] = 1;
      else
        cur[j] = bfind(1, n, need - arr[j]);
      mem[j] = arr[j];
    }
    for (int j = 1; j <= n; j++) {
      printf("%d ", cur[j]);
      arr[j] += mem[cur[j]];
    }
    printf("\n");
  }
  return 0;
}
