#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-8;
const long double PI = 3.1415926535897932384626433832795;
const long double E = 2.7182818284;
const int INF = 1000000000;
int main(void) {
  int n, k;
  cin >> n >> k;
  int ans[k][n];
  int dp[k + 1][n];
  int i;
  int res[n];
  for (int i = 0; i < int(n); i++) res[i] = n - i - 1;
  for (int i = 0; i < int(n - 1); i++) dp[0][i] = 1;
  dp[0][n - 1] = 0;
  for (i = 1; i <= k; i++) {
    for (int j = 0; j < int(n); j++) {
      if (2 * dp[i - 1][j] <= res[j]) {
        dp[i][j] = dp[i - 1][j] << 1;
        ans[i - 1][j] = j + 1;
      } else if (dp[i - 1][j] == res[j]) {
        dp[i][j] = dp[i - 1][j];
        ans[i - 1][j] = n;
      } else {
        for (int h = j + 1; h < n - 1; h++) {
          if (dp[i - 1][j] + dp[i - 1][h] == res[j]) {
            dp[i][j] = res[j];
            ans[i - 1][j] = h + 1;
          }
        }
      }
    }
  }
  for (int i = 0; i < int(k); i++) {
    for (int j = 0; j < int(n); j++) {
      cout << ans[i][j] << ' ';
    }
    cout << endl;
  }
  return 0;
}
