#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, gap = 0;
  cin >> n >> k;
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      if (j + gap + 1 > n)
        cout << n << " ";
      else
        cout << (j + gap) + 1 << " ";
    }
    cout << endl;
    gap = (gap << 1) + 1;
  }
  return 0;
}
