#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> cur(n, 1);
  cur[n - 1] = 0;
  for (int i = (0); i <= ((k)-1); i++) {
    vector<int> nxt = cur;
    for (int j = (0); j <= ((n)-1); j++) {
      if (j) printf(" ");
      if (cur[j] == n - 1 - j)
        printf("%d", n);
      else if (cur[j] + cur[j + (1 << i)] == n - 1 - j) {
        printf("%d", j + (1 << i) + 1);
        nxt[j] += cur[j + (1 << i)];
      } else
        printf("1"), nxt[j] += cur[0];
    }
    cur = nxt;
    puts("");
  }
  return 0;
}
