#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, S;
  cin >> N >> S;
  vector<long long> A(N);
  for (int(i) = 0; (i) < (N); (i)++) cin >> A[i];
  vector<vector<long long> > DP(N + 1);
  for (int(i) = 0; (i) < (N + 1); (i)++) DP[i].resize(S + 3, 0);
  DP[0][S + 1] = 1;
  for (int(i) = 0; (i) < (N); (i)++) {
    long long Atmp = A[i];
    for (int(j) = 0; (j) < (S + 1); (j)++) {
      DP[i + 1][j] += DP[i][j];
      DP[i + 1][j] %= 998244353;
      long long jnxt = j + Atmp;
      if (jnxt > S) continue;
      DP[i + 1][jnxt] += DP[i][j];
      DP[i + 1][jnxt] %= 998244353;
    }
    DP[i + 1][0] += DP[i][S + 1];
    DP[i + 1][0] %= 998244353;
    DP[i + 1][Atmp] += DP[i][S + 1];
    DP[i + 1][Atmp] %= 998244353;
    DP[i + 1][S + 1] += DP[i][S + 1];
    DP[i + 1][S + 1] %= 998244353;
    DP[i + 1][S + 2] += DP[i][S];
    DP[i + 1][S + 2] %= 998244353;
    if (S - Atmp >= 0) {
      DP[i + 1][S + 2] += DP[i][S - Atmp];
      DP[i + 1][S + 2] %= 998244353;
    }
    if (S - Atmp == 0) {
      DP[i + 1][S + 2] += DP[i][S + 1];
      DP[i + 1][S + 2] %= 998244353;
    }
    DP[i + 1][S + 2] += DP[i][S + 2];
    DP[i + 1][S + 2] %= 998244353;
  }
  long long ans = DP[N][S + 2];
  cout << ans << endl;
  return 0;
}
