#include <bits/stdc++.h>
using namespace std;
int n, k;
int main() {
  cin >> n >> k;
  for (int pow = 0; pow < k; pow++, cout << n << endl)
    for (int i = 0; i + 1 < n; i++)
      cout << ((n - i - 2) & 1 << pow ? n - (1 << pow) : n) << " ";
  return 0;
}
