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