#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 998244353LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
 
ll n,k,x,y;

//moddivとnCkとgarner
//c剰余下でaをbで割った値
ll moddiv(ll a,ll b,ll c){
	ll x0=c,x1=b,x2,n0=0LL,n1=1LL,n2,t=a%b,m,ans;
	if (t==0LL) return a/b;
		for(int i=0;i<900;i++){
      m=x0/x1;
      x2=x0-x1*m;
      n2=(n0-m*n1)%c;
      if (x2==1LL){
        ans=(n2+c)%c;
        break;
      }
      x0=x1;x1=x2;
      n0=n1;n1=n2;
    }
	return (a+((t*ans)%c)*b-t)/b;
}

//nCk
vi mulmod(301);//0!,1!,2!,3!,4!,,,,
void first_nCk(){
  mulmod[0]=1LL;
  for(ll i=1;i<301;i++){
    mulmod[i]=mulmod[i-1]*i%MOD;
  }
}
 
ll nCk(ll nn,ll kk){
  return moddiv(mulmod[nn],mulmod[kk]*mulmod[nn-kk]%MOD,MOD);
}
 
ll modinv(ll a,ll b){
  return moddiv(1,a,b);
}


int main(){
  ll ans=0;
  first_nCk();
  cin >> n >> k;
  k++;
  vi a(n),tmsum(k),datasum(k);
  vvi data(n, vi(k));
  REP(i,n) cin>>a[i];
 
  for(ll i=0;i<n;i++){
    ll gege=1;
    ll ggg=1;
    for(ll j=0;j<k;j++){
      data[i][j]=gege;
      gege=a[i]*gege%MOD;
      tmsum[j]+=ggg;
      ggg=ggg*a[i]*2%MOD;
    }
  }
  
  for(ll i=0;i<n;i++){
    for(ll j=0;j<k;j++){
      datasum[j]+=data[i][j];
    }
  }
  
  for(ll j=0;j<k;j++){
    tmsum[j]%=MOD;
    datasum[j]%=MOD;
  }
 
  for(ll i=1;i<k;i++){
    ans=0;
    ll tmp=MOD;
    for(ll j=0;j<i+1;j++){
      tmp=tmp+datasum[i-j]*datasum[j]%MOD*nCk(i,j)%MOD;
    }
    tmp=(tmp-tmsum[i])%MOD;
    cout<<(moddiv(tmp,2,MOD))<<endl;
  }
  return 0;
}
#include <bits/stdc++.h>

using namespace std;

#define ar array
#define ll long long

const int MAX_N = 1e5 + 1;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;

ll qexp(ll a, ll b, ll m) {
    ll res = 1;
    while (b) {
        if (b % 2) res = res * a % m;
        a = a * a % m;
        b /= 2;
    }
    return res;
}

void solve() {
    // (M + N) choose (sum A_i + N)
    int N, M;
    cin >> N >> M;
    int sum = 0;
 
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        sum += a;
    }
 
    int n = M + N;
    int r = sum + N;
    ll choose;
 
    if (n < r) {
        choose = 0;
    } else {
        choose = 1;
 
        for (int i = 0; i < r; i++)
            choose = choose * (n - i) % MOD * qexp(i + 1, MOD - 2, MOD) % MOD;
    }
    cout << choose << "\n";
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int tc = 1;
    // cin >> tc;
    for (int t = 1; t <= tc; t++) {
        // cout << "Case #" << t  << ": ";
        solve();
    }
}