#include <bits/stdc++.h>
using namespace std;
int n, k;
int res[10100][30];
int main() {
  scanf("%d %d", &n, &k);
  memset(res, 0, sizeof(res));
  for (int i = 1; i < n; i++) {
    int x = 1;
    int ind = 0;
    while (1) {
      if (x * 2 > i) break;
      res[i][ind] = i;
      x = x * 2;
      ind++;
    }
    res[i][ind] = i - x;
  }
  for (int j = 0; j < (k); j++) {
    for (int i = 0; i < (n); i++) {
      printf("%d ", n - res[n - 1 - i][j]);
    }
    printf("\n");
  }
  return 0;
}
