#include <bits/stdc++.h>
using namespace std;
int arr[11111];
int out[11111];
int temp[11111];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = (1); i < (n); ++i) arr[i] = 1;
  arr[n] = 0;
  int qtd = 0;
  int ct = 5;
  while (arr[1] != n - 1) {
    memcpy(temp, arr, sizeof arr);
    out[qtd++] = n;
    int j = n - 1;
    int qt = 0;
    while (j >= 1 && arr[j] == n - j) {
      j--;
      qt++;
      out[qtd++] = n;
    }
    int act = qt;
    while (j >= 1 && qt) {
      arr[j] += temp[j + act];
      out[qtd++] = j + act;
      j--;
      qt--;
    }
    while (j >= 1) {
      arr[j] += temp[j + 1];
      out[qtd++] = j + 1;
      j--;
    }
    for (int i = qtd - 1; i >= 0; --i) printf("%d ", out[i]);
    printf("\n");
    k--;
    qtd = 0;
    ct--;
  }
  while (k--) {
    for (int i = (0); i < (n); ++i) printf("%d ", n);
    printf("\n");
  }
  return 0;
}
