#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, kk, a, j;
  cin >> n >> k;
  int arr[n + 1], temp[n + 1];
  memset(arr, 1, sizeof(arr));
  arr[n] = 0;
  for (i = 0; i < k; i++) {
    kk = n;
    a = (int)pow(2, i);
    for (j = n; j > n - a; j--) temp[j] = n;
    for (j = n - a; j >= 1; j--) {
      temp[j] = kk;
      arr[j] += arr[kk];
      kk--;
    }
    for (j = 1; j <= n; j++) cout << temp[j] << " ";
    cout << "\n";
  }
  return 0;
}
