#include <bits/stdc++.h>
using namespace std;
int n, k;
int main() {
  scanf("%d%d", &n, &k);
  if (n == 1) {
    for (int i = 0; i < k; ++i) cout << "1" << endl;
    return 0;
  }
  int c = 1, j = 0;
  while (n - 1 > c) {
    for (int i = 1; i < n; ++i) printf("%d ", min(i + c, n));
    printf("%d\n", n);
    ++j;
    c *= 2;
  }
  for (int i = 0; i < (k - j); ++i) {
    for (int i = 1; i < n; ++i) printf("%d ", n);
    printf("%d\n", n);
  }
}
