#include #include using namespace std; #define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i=i##_begin_;i--) #define REP(i, n) FOR(i,0,n) #define IREP(i, n) IFOR(i,0,n) #include using mint = atcoder::modint998244353; int main() { cin.tie(nullptr), ios::sync_with_stdio(false); int N, K; cin >> N >> K; vector A(N); for (auto &x : A) cin >> x; vector pow2(K * 2 + 10, 1); FOR(i, 1, pow2.size()) pow2[i] = pow2[i - 1] * 2; vector dpn(3, vector(K + 1)); vector dpsum(3, vector(K + 1)); dpn[0][0] = pow2[K * 2].inv(); vector ap(K + 1, 1); REP(i, N) { FOR(k, 1, K + 1) ap[k] = ap[k - 1] * A[i]; REP(k, K) { dpsum[0][k + 1] += dpsum[0][k]; dpn[0][k + 1] += dpn[0][k]; } IREP(k, K) { dpsum[2][k] += dpsum[2][k + 1]; dpn[2][k] += dpn[2][k + 1]; } REP(d, 3) REP(k, K + 1) { dpsum[d][k] = (dpsum[d][k] + dpn[d][k] * ap[k]) * pow2[k]; dpn[d][k] *= pow2[k]; } IREP(d, 2) { dpsum[d + 1][K] += dpsum[d][K]; dpn[d + 1][K] += dpn[d][K]; dpsum[d][K] = dpn[d][K] = 0; } } cout << accumulate(dpsum.back().begin(), dpsum.back().end(), mint(0)).val() << '\n'; }