#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = 3.1415926535897932384626433832795;
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T abs(T x) {
  return x < 0 ? -x : x;
}
const int nmax = 15000;
int n, k;
int a[nmax], pos[nmax];
int main() {
  cin >> n >> k;
  for (int i = 0; i < (int)(n); i++) {
    a[i] = 1;
    pos[i] = i + 1;
  }
  a[n - 1] = 0;
  pos[n - 1] = n - 1;
  for (int i = 0; i < (int)(k); i++) {
    for (int j = 0; j < (int)(n); j++) {
      while (a[j] + a[pos[j]] > n - j - 1) pos[j]++;
      printf("%d ", pos[j] + 1);
      a[j] += a[pos[j]];
    }
    puts("");
  }
  return 0;
}
