#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 10010;
const int INF = 1 << 28;
const int EPS = 1e-9;
int n, k;
int a[MAX_N];
int c[MAX_N];
int v[MAX_N];
int main() {
  cin >> n >> k;
  a[0] = 0;
  for (int i = (1); i < (n); i++) a[i] = 1;
  for (int i = (0); i < (k); i++) {
    for (int i = (0); i < (n); i++) {
      c[i] = lower_bound(a, a + n, i - a[i]) - a;
      if (c[i] == n) c[i] = n - 1;
      v[i] = a[c[i]];
    }
    for (int i = (0); i < (n); i++) a[i] += v[i];
    for (int i = (0); i < (n); i++)
      printf("%d%c", n - c[n - i - 1], " \n"[i == n - 1]);
  }
  return 0;
}
