#include <bits/stdc++.h>
using namespace std;
int n, k;
string st;
int main() {
  cin >> n >> k;
  int arr[10005], a2[10005];
  for (int i = 0; i < n + 2; i++) a2[i] = arr[i] = 1;
  arr[n] = 0;
  vector<int> p;
  if (n == 1) {
    for (int i = 0; i < k; i++) cout << 1 << endl;
    return 0;
  }
  for (int i = 0; i < k; i++) {
    p.clear();
    p.push_back(n);
    p.push_back(n);
    for (int j = n - 2; j > 0; j--) {
      if (arr[j] < (n - j)) {
        if (n - j - arr[j] < pow(2., double(1 + i))) {
          int dif = (n - j) - arr[j];
          p.push_back(n - dif);
          arr[j] += a2[n - dif];
        } else {
          p.push_back(1);
          arr[j] += a2[j];
        }
      } else
        p.push_back(n);
    }
    for (int j = p.size() - 1; j >= 0; j--) {
      a2[j] = arr[j];
      cout << p[j] << ' ';
    }
    cout << endl;
  }
  return 0;
}
