#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, z, k;
int main() {
  cin >> n >> k;
  int temp = 1;
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) printf("%d ", min(n, j + temp));
    cout << endl;
    temp = temp * 2;
  }
  return 0;
}
