#include #include #include #include #include using namespace std; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; #define rep(i,n) for(int i=0; i<(int)(n); i++) const i64 INF = 1001001001001001001; using modint = atcoder::static_modint<998244353>; vector> solve(int n, int h){ vector ansFlat(n); int p1 = 0, p2 = n; for(int d=1; n%d==0; d*=2){ int D = n / d; if(d != 1) rep(i,D) ansFlat[p1++] = D; rep(i,d) ansFlat[--p2] = d; } vector> ans(h, vector(n/h)); rep(y,h) rep(x,n/h) ans[y][x] = ansFlat[y*(n/h)+x]; return ans; } int main(){ int N; cin >> N; int H; cin >> H; int W = N / H; vector> ans; if(H == (H & -H)){ ans = solve(N, H); } else{ vector> buf = solve(N, W); ans.assign(H, vector(W)); rep(y,H) rep(x,W) ans[y][x] = buf[x][y]; } rep(y,H){ rep(x,W){ if(x) cout << ' '; cout << ans[y][x]; } cout << '\n'; } return 0; } struct ios_do_not_sync{ ios_do_not_sync(){ std::ios::sync_with_stdio(false); std::cin.tie(nullptr); } } ios_do_not_sync_instance;