#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:36777216")
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<int> a(n + 1, 1);
  a[n] = 0;
  int mx = 1, l;
  for (int i = 0; i < k; i++) {
    for (int i = 1; i <= n; i++) {
      if (a[i] == n - i)
        cout << n << ' ';
      else if (a[i] + mx >= n - i) {
        cout << i + a[i] << ' ';
        a[i] = n - i;
      } else {
        cout << "1 ";
        a[i] += mx;
      }
    }
    mx = mx * 2;
    cout << "\n";
  }
}
