#include <bits/stdc++.h>
using namespace std;
int pro[100100];
int maxx[15];
int n, k;
void initZ() {
  for (int i = 1; i <= n; ++i) {
    if (i == n)
      pro[i] = 0;
    else
      pro[i] = 1;
  }
  maxx[0] = 1;
  for (int i = 1; i < 15; ++i) {
    maxx[i] = maxx[i - 1] * 2;
  }
}
void step(int step) {
  if (step > 14) step = 14;
  for (int i = 1; i <= n; ++i) {
    if ((n - i) >= maxx[step]) {
      cout << 1 << " ";
      pro[i] = pro[i] * 2;
    } else {
      cout << n - ((n - i) - pro[i]) << " ";
      pro[i] = (n - i);
    }
  }
}
void solve() {
  initZ();
  for (int i = 1; i <= k; ++i) {
    step(i);
    cout << endl;
  }
}
int main() {
  cin >> n >> k;
  solve();
}
