#include <bits/stdc++.h>
using namespace std;
int a[10010];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i < n; ++i) a[i] = 1;
  while (k--) {
    for (int i = 1; i <= n; ++i) {
      int x = n - (n - i - a[i]);
      cout << x << ' ';
      a[i] += a[x];
    }
    cout << endl;
  }
  return 0;
}
