#include <bits/stdc++.h>
using namespace std;
template <typename T>
T nextVal() {
  T tmp;
  cin >> tmp;
  return tmp;
}
int main() {
  int n = nextVal<int>();
  int k = nextVal<int>();
  vector<int> cval(n, 1);
  cval[n - 1] = 0;
  for (int i = 0; i < k; ++i) {
    for (int j = 0; j < n; ++j) {
      int target = n - j - 1;
      if (cval[j] * 2 <= target) {
        cout << j + 1 << " ";
        cval[j] <<= 1;
      } else {
        int toAdd = target - cval[j];
        cout << n - toAdd << " ";
        cval[j] = target;
      }
    }
    cout << "\n";
  }
  return 0;
}
