#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000 * 1000 * 1000 + 7LL;
const double EXP = 1e-6;
const int MAX = 100001;
int main() {
  int n, k;
  while (cin >> n >> k) {
    int a[10001];
    for (int i = 1; i <= n; i++) a[i] = 1;
    a[n] = 0;
    while (k--) {
      for (int i = 1; i <= n; i++) {
        if (a[i] + a[i] > n - i) {
          int p = n - i - a[i];
          int o = n - p;
          a[i] += a[o];
          cout << o << " ";
        } else if (a[i] == n - i)
          cout << n << " ";
        else {
          a[i] += a[i];
          cout << i << " ";
        }
      }
      cout << endl;
    }
  }
  return 0;
}
