#include<bits/stdc++.h>
#define CT cout << "\n-----------------------\n";
using namespace std;
typedef long long ll;
const int inf=1<<30;
const ll Inf=1ll<<60;
const int N=100005;
const ll mod=998244353;
const ll inv2=(mod+1)/2;
int a[N],b[N],n,m;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> m;
	for(int i=1;i<=n;++i) cin >> a[i];
	for(int i=1;i<=m;++i){
		for(int j=1;j<=n;++j)
			cout << a[j] << ' ';
		cout << '\n';
		for(int j=1;j+j<=n;++j)
			b[j]=a[j]+a[n-j+1];
		for(int j=1;j<=n;++j)
			a[j]=inv2*b[(j+1)>>1]%mod;
	}
	return 0;
}

