#include <bits/stdc++.h>
using namespace std;
int a[100001] = {0}, b[100001], n, m;
int main() {
  cin >> n >> m;
  for (int k = 1; k <= n; ++k) a[k] = 1, b[k] = k;
  a[n] = 0;
  for (int k = 1; k <= m; ++k) {
    for (int i = 1; i <= n; ++i) {
      long long f = b[i];
      for (int j = f; j <= n; ++j)
        if (a[i] + a[j] <= n - i) {
          cout << j << ' ';
          a[i] = a[i] + a[j];
          break;
        }
    }
    cout << endl;
  }
  return 0;
}
