#include <bits/stdc++.h>
using namespace std;
int a[1 << 14];
int target[1 << 14], N, K;
void scan() { cin >> N >> K; }
void solve() {
  for (int i = 0; i < N; ++i) target[i] = N - i - 1;
  for (int i = 0; i < N; ++i) a[i] = 1;
  a[N - 1] = 0;
  for (int mvs = 0; mvs < K; ++mvs) {
    for (int i = 0; i < N; ++i)
      if (a[i] == target[i])
        cout << N << " ";
      else {
        int l = 0;
        for (int j = 0; j < 20; ++j)
          if (((1 << j) & target[i]) == 0 && ((1 << j) & a[i])) l = 1;
        if (l) {
          cout << i + 1 << " ";
          a[i] *= 2;
        } else {
          if (target[i] & (1 << mvs) && !(a[i] & (1 << mvs))) {
            cout << N - (1 << mvs) << " ";
            a[i] += (1 << mvs);
          } else
            cout << N << " ";
        }
      }
    cout << endl;
  }
}
int main() {
  scan();
  solve();
}
