# coding: utf-8
mod = 998244353
N, S = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))

dp = [[0 for _ in range(S+2)] for i in range(N+1)]

for k in range(0, N):
  for s in range(0, S+1):
    dp[k+1][s] += (2 * dp[k][s] - dp[k-1][s]) % mod
  if S > A[k+1]:
    for s in range(1,S-A[k+1]+1):
      dp[k+1][s+A[k+1]] += (dp[k][s] - dp[k-1][s]) % mod
  dp[k+1][A[k+1]] += k+1

print(dp[N][S] % mod)