#include <bits/stdc++.h>
using namespace std;
int n, k, a[200000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (int i = 1; i < n; i++) a[i] = 1;
  for (int i = 1; i <= k; i++, cout << endl)
    for (int i = 1; i <= n; i++) {
      int f = i + a[i];
      a[i] += a[i + a[i]];
      cout << f << " ";
    }
}
