#include <bits/stdc++.h>
using namespace std;
long long const INF = (long long)1e9;
long long const INF64 = (long long)4e18;
long long const v10e5 = (long long)100000;
long long const v10e6 = (long long)1000000;
long long const v10e9 = (long long)1000000000;
long long const s10e5 = (long long)100000 + 10;
long long const s10e6 = (long long)1000000 + 10;
long long const s10e9 = (long long)1000000000 + 10;
long long __dummy__;
int main() {
  ios_base::sync_with_stdio(0);
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n + 1, 1);
  a[n] = 0;
  long long max_ = 1;
  for (long long(i) = (1); (i) <= (k); ++i) {
    for (long long(i) = (1); (i) <= (n); ++i) {
      if ((n - i) - a[i] >= max_) {
        cout << n - max_ << " ";
        a[i] += max_;
      } else {
        cout << i + a[i] << " ";
        a[i] = n - i;
      }
    }
    cout << endl;
    max_ = a[1];
  }
  return 0;
}
