#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int cnt = 2;
  for (int k_index = 0; k_index < k; ++k_index) {
    vector<int> arr(n);
    for (int index = n - 1; index >= 0 && index >= n - cnt; --index)
      arr[index] = n;
    for (int index = n - cnt - 1; index >= 0 && index >= n - 2 * cnt + 1;
         --index)
      arr[index] = index + cnt - 1 + 1;
    for (int index = 0; index < n - 2 * cnt + 1; ++index)
      arr[index] = index + 1;
    for (int index = 0; index < n; ++index) cout << arr[index] << " ";
    cout << endl;
    cnt = cnt * 2 - 1;
  }
  return 0;
}
