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