#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:167772160")
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int x[10010][22] = {0};
  for (int i = 1; i <= n; i++) {
    int deg2 = -1;
    for (int j = 0; j < 22; j++)
      if (i == (1 << j)) deg2 = j;
    if (deg2 == -1) {
      int p = i;
      while (p > 0) {
        int deg = -1;
        while ((1 << (deg + 1)) <= p) deg++;
        x[i][deg] = 1;
        p -= (1 << deg);
      }
    } else {
      for (int p = 0; p < deg2; p++) x[i][p] = 1;
      x[i][0]++;
    }
  }
  bool good[10100] = {0};
  for (int deg = 0; deg < k; deg++) {
    for (int i = n - 2; (i + 1); i--) {
      if (x[i][deg]) {
        x[i][deg]--;
        cout << n - (1 << deg) << " ";
      } else if (x[i][0]) {
        x[i][0]--;
        cout << n - 1 << " ";
      } else
        cout << n << " ";
    }
    cout << n << "\n";
  }
  return 0;
}
