#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int g;
  if (n == 1)
    g = 0;
  else
    g = 1;
  int shag = 1;
  int s = 0;
  int b = n - 1;
  if (n != 1) do {
      b -= shag;
      for (int i = 0; i < b; i++) {
        cout << n - shag << ' ';
        if (i == 0) g += shag;
      }
      if (shag == 1) {
        cout << n << ' ' << n << ' ' << endl;
      } else {
        int j = shag - 1;
        for (int i = b; i < b + shag - 1; i++) {
          if (i == 0) g += j;
          cout << n - j << ' ';
          j--;
        }
        for (int i = b + shag - 1; i < n; i++) cout << n << ' ';
      }
      shag = 2 * shag;
      s++;
      cout << endl;
    } while (n - 1 >= 2 * shag);
  if (g != n - 1) {
    int f = b - 1;
    for (int i = 0; i < b - 1; i++) {
      cout << n - f << ' ';
      f--;
    }
    for (int i = b - 1; i < n; i++) {
      cout << n << ' ';
    }
    cout << endl;
    s++;
  }
  while (s < k) {
    for (int i = 0; i < n; i++) {
      cout << n << ' ';
    }
    s++;
    cout << endl;
  }
  return 0;
}
