#include <bits/stdc++.h>
using namespace std;
const int maxn = 10011;
int n, k;
int a[maxn];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n - 1; i++) a[i] = 1;
  for (int j = 0; j < k; j++) {
    for (int i = 0; i < n; i++) {
      if (a[i] == n - i - 1) {
        cout << n << " ";
      } else if (a[i] * 2 <= n - i - 1) {
        cout << i + 1 << " ";
        a[i] *= 2;
      } else {
        cout << n - (n - i - 1 - a[i]) << " ";
        a[i] += (n - i - 1 - a[i]);
      }
    }
    cout << endl;
  }
}
