#include <bits/stdc++.h>
using namespace std;
int in[10005];
int main() {
  int n, k;
  cin >> n >> k;
  if (n <= 2) {
    for (int i = 0; i < k; i++) {
      for (int j = 0; j < n; j++) {
        printf("%d ", n);
      }
      cout << endl;
    }
  } else {
    for (int i = 1; i < n; i++) in[i] = 1;
    int fix = n - 1;
    for (int i = 1; i <= k; i++) {
      for (int i = 1; i < fix; i++) {
        int need = (n - i) - in[i];
        int g = max(n - need, fix);
        in[i] += in[g];
        printf("%d ", g);
      }
      for (int i = fix; i <= n; i++) printf("%d ", n);
      for (int i = n; i >= 1; i--) {
        if (in[i] != n - i) {
          fix = i + 1;
          break;
        }
      }
      cout << endl;
    }
  }
  return 0;
}
