#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void maximize(T& a, const T b) {
  if (b > a) a = b;
}
template <typename T>
inline void minimize(T& a, const T b) {
  if (b < a) a = b;
}
template <typename T>
inline T maximum(const T& a, const T& b) {
  return a > b ? a : b;
}
template <typename T>
inline T minimum(const T& a, const T& b) {
  return a < b ? a : b;
}
int scan() {
  char ch;
  while (!isdigit(ch = getchar()))
    ;
  int x = ch - '0';
  while (isdigit(ch = getchar())) x = x * 10 + ch - '0';
  return x;
}
int get_op(int x, int k) {
  int z = 1, cnt = 0;
  for (; z <= x; z += z, ++cnt)
    ;
  if (cnt > k) return x;
  if (cnt == k) return x ^ (z / 2);
  return 0;
}
void work() {
  int n = scan(), k = scan();
  for (int i = 1; i <= k; ++i) {
    for (int j = 0; j < n; ++j) cout << n - get_op(n - j - 1, i) << ' ';
    cout << endl;
  }
}
int main() { work(); }
