#include <bits/stdc++.h>
using namespace std;
int A[10005], N, K;
int main() {
  cin >> N >> K;
  fill_n(A + 1, N - 1, 1);
  for (int i = 1; i <= K; ++i) {
    for (int j = 1; j <= N; ++j) {
      cout << j + A[j] << ' ';
      A[j] += A[j + A[j]];
    }
    cout << endl;
  }
  return 0;
}
