#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, s;
  cin >> n >> s;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a.at(i);
  vector<vector<long long> > dp(3001, vector<long long>(n + 1));
  dp[0][0] = 1;
  for (long long i = 1; i < n + 1; i++) {
    dp[0][i] = ((i + 1) * (i + 2) / 2) % 998244353;
  }
  for (long long i = 1; i < 3001; i++) {
    if (i == a[0]) dp[i][1] = 1;
    for (long long j = 2; j < n + 1; j++) {
      dp[i][j] = (dp[i][j - 1] * 2 - dp[i][j - 2]) % 998244353;
      if (i >= a[j - 1])
        dp[i][j] =
            (dp[i][j] + dp[i - a[j - 1]][j - 1] - dp[i - a[j - 1]][j - 2]) %
            998244353;
    }
  }
  cout << dp[s][n] % 998244353 << "\n";
  return 0;
}
