#include <bits/stdc++.h>
using namespace std;
const int maxn = 100500;
const int infi = (1 << 30);
const long long infl = (1LL << 62);
const double eps = 1e-9;
const long long mod = 1000000007LL;
const double pi = acos(-1.0);
int n, k;
int a[maxn], c[maxn];
int main() {
  cin >> n >> k;
  for (int i = 1; i < n; i++) a[i] = 1;
  a[0] = 0;
  for (int i = 0; i < k; i++) {
    for (int j = 0; j < n; j++) {
      int second = int(upper_bound(a, a + n, j - a[j] - 1) - a);
      if (second == n) second = n - 1;
      c[j] = second;
    }
    for (int j = 0; j < n; j++) {
      a[j] += a[c[j]];
    }
    for (int j = n - 1; j >= 0; --j) cout << n - c[j] << " ";
    cout << endl;
  }
  return 0;
}
