#include <bits/stdc++.h>
using namespace std;
const int N = 10005;
int n, k, x, value, pos[N], cur[N], nxt[N];
vector<int> vec;
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i < n; i++)
    cur[i] = 1, pos[cur[i]] = i, vec.push_back(cur[i]);
  cur[n] = 0, pos[cur[n]] = n, vec.push_back(cur[n]);
  sort(vec.begin(), vec.end());
  for (int i = 0; i < k; i++) {
    sort(vec.begin(), vec.end());
    for (int j = 1; j <= n; j++) {
      x = (n - j) - cur[j];
      value = upper_bound(vec.begin(), vec.end(), x) - vec.begin() - 1;
      value = vec[value];
      nxt[j] = cur[j] + value;
      printf("%d ", pos[value]);
    }
    printf("\n");
    vec.clear();
    for (int j = 1; j <= n; j++)
      cur[j] = nxt[j], pos[cur[j]] = j, vec.push_back(cur[j]);
  }
  return 0;
}
