#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:300000000")
const long double eps = 1e-20;
const long double pi = acos(-1.0);
const long long inf = 1000 * 1000 * 1000 * 1000 * 1000 * 1000;
const long long base = 1000 * 1000 * 1000 + 7;
using namespace std;
int q[111111];
int a[111111];
int b[111111];
map<int, int> m;
int n, k;
int main() {
  ios_base ::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 0; i < (n); i++) a[i] = 1;
  a[n - 1] = 0;
  for (int i = 0; i < (n); i++) q[i] = n - i - 1;
  for (int w = 0; w < (k); w++) {
    for (int i = 0; i < (n); i++) b[i] = a[i];
    for (int i = 0; i < (n); i++) m[b[i]] = i;
    for (int i = 0; i < (n); i++) {
      if (a[i] + b[0] > q[i]) {
        cout << m[q[i] - a[i]] + 1 << " ";
        a[i] = q[i];
      } else {
        cout << 1 << " ";
        a[i] = a[i] + b[0];
      }
    }
    cout << endl;
  }
  return 0;
}
