#include <bits/stdc++.h>
using namespace std;
int a[11111];
int ta[11111];
int ti[11111];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n - 1; i++) {
    a[i] = 1;
  }
  while (k-- > 0) {
    for (int i = 0; i < n; i++) {
      ti[i] = i;
      if (2 * a[i] > n - 1 - i) {
        int ll = n - 1 - i - a[i];
        ti[i] = n - 1 - ll;
      }
      ta[i] = a[ti[i]];
    }
    for (int i = 0; i < n; i++) {
      cout << ti[i] + 1 << " ";
      a[i] += ta[i];
    }
    cout << "\n";
  }
  return 0;
}
