#include <bits/stdc++.h>

using namespace std;
// #include <atcoder/all>
// using namespace atcoder;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

//Write From this Line


const int dy[] = {0,0,1,-1};
const int dx[] = {1,-1,0,0};
const ll mod = 1e9+7;
//const ll mod = 998244353;
const double PI=3.14159265358979323846;
const int INF = 1001001001;
const int MAX = 4000005;

int main()
{
	ll h,w ;
	cin >> h >>w ;
	vector<string> s(h);
	rep(i, h)cin>>s[i];

	ll k = 0;
	rep(i,h){
		rep(j,w){
			if(s[i][j] == '.')k++;
		}
	}
	vector<ll> k_n(MAX);
	k_n[0] = 1;
	For(i,1,MAX){
		k_n[i] = (k_n[i-1] * 2)%mod;
	}

	// 全てのマスについて，左右に何個，上下に何個ある．っていうのを数え上げしていく
	vector<vector<ll>> gyo(h,vector<ll>(w,0));
	vector<vector<ll>> retu(h,vector<ll>(w,0));
	rep(i,h){
		// 行ごとに数える
		int count = 0;
		rep(j,w){
			if(s[i][j] == '.'){
				gyo[i][j] = ++count;
			}
			else {
				gyo[i][j] = 0;
				count = 0;
			}
		}
	}
	rep(i,h){
		for(int j = w - 2; j >= 0; j--){
			if(s[i][j] == '#') continue;
			if(s[i][j+1] == '#')continue;
			gyo[i][j] = gyo[i][j+1];
		}
	}
	rep(i,w){
		int count = 0;
		rep(j,h){
			if(s[j][i] == '.'){
				retu[j][i] = ++count;
			}
			else {
				retu[j][i] = 0;
				count = 0;
			}
		}
	}
	rep(i,w){
		for(int j =h - 2; j >= 0; j--){
			if(s[j][i] == '#') continue;
			if(s[j+1][i] == '#')continue;
			retu[j][i] = retu[j+1][i];
		}
	}


	ll ans = 0;
	ans = k * k_n[k];
	ans %= mod;
	rep(i,h){
		rep(j,w){
			if(s[i][j] == '#') continue;
			ll x = gyo[i][j];
			ll y = retu[i][j];
			// そのマスが照らされない場合っていうのは，2^(k-(x+y))通り
			ll ind = k - (x+y-1);
			ll now = k_n[ind];
			ans -= now;
			while(ans < 0) ans += mod;
		}
	}
	cout << ans << endl;
}

#include<bits/stdc++.h>

using namespace std;

#define int long long

const int M=998244353;
const int inf=4e18;
const int N=300;

int fact[N+1];

int power(int x,int y)
{
	if(y<0)
		return power(x,M-2)*power(x,y+1)%M;
	y%=(M-1);
	int res=1;
	while(y>0)
	{
		if(y&1)
			res=res*x%M;
		y=y>>1;
		x=x*x%M;
	}
	return res;
}

int nCr(int n,int r)
{
	if(r>n||r<0)
		return 0;
	if(r==0)
		return 1;
	return(fact[n]*power(fact[r],M-2)%M*power(fact[n-r],M-2)%M)%M;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,k;cin>>n>>k;
	int a[n+1];
	for(int i=1;i<=n;i++)
		cin>>a[i];
	int po[n+1][k+1];
	for(int i=1;i<=n;i++)
	{
		po[i][0]=1;
		for(int j=1;j<=k;j++)
			po[i][j]=po[i][j-1]*a[i]%M;
	}
	int f[k+1];f[0]=n%M;
	for(int i=1;i<=k;i++)
	{
		f[i]=0;
		for(int j=1;j<=n;j++)
			f[i]=(f[i]+po[j][i])%M;
	}
	fact[0]=1;
	for(int i=1;i<=N;i++)
		fact[i]=fact[i-1]*i%M;
	for(int x=1;x<=k;x++)
	{
		int o=0;
		for(int p=0;p<=x;p++)
			o=(o+nCr(x,p)*(f[x-p]%M*f[p]%M-f[x]%M+M)%M*power(2,-1)%M)%M;
		cout<<o<<'\n';
	}
}