#include using namespace std; using ll = long long; int main() { int n, h; cin >> n >> h; int t = n, k = 0; while (t % 2 == 0) t /= 2, k++; vector a; for (int i = 0; i <= k; i++) { int l = 1 << i; for (int j = 0; j < l; j++) { a.push_back(l); } } for (int i = 0; i <= k; i++) { int l = t << i; for (int j = 0; j < l; j++) { a.push_back(l); } } int w = n / h; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { int k = h % t == 0 ? j * h + i : i * w + j; cout << a[k] << " \n"[j == w - 1]; } } return 0; }