#include <bits/stdc++.h>
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long double EPS = 0.001;
const long double EPS2 = 1e-6;
const long double PI = acos(-1);
const int MOD7 = 1000000007;
const int MOD9 = 1000000009;
const int a228 = 18;
const int inf = 1e9;
const long long kekmod = 1791791791;
const long long bestmod = 1148822869;
const int mod = 998244353;
signed main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  srand(time(NULL));
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  for (long long i = 0; i < a.size(); ++i) cin >> a[i];
  ;
  int ans = 0;
  for (int l = 0; l < n; ++l) {
    int now = 1;
    for (int r = l; r < n; ++r) {
      ans += now;
      if (ans >= mod) ans -= mod;
      now *= 2;
      now %= mod;
    }
  }
  vector<int> dp(s + 228);
  for (int i = 0; i < n; ++i) {
    for (int w = s + 1; w >= 1; --w) {
      if (w + a[i] > s + 1) {
        dp[s + 1] += dp[w];
        if (dp[s + 1] >= mod) dp[s + 1] -= mod;
      } else {
        dp[w + a[i]] += dp[w];
        if (dp[w + a[i]] >= mod) dp[w + a[i]] -= mod;
      }
    }
    int now = min(a[i], s + 1);
    dp[now] += i + 1;
    if (dp[now] >= mod) dp[now] -= mod;
    for (int w = 1; w <= s + 1; ++w) {
      if (w != s) {
        ans -= dp[w];
        if (ans < 0) ans += mod;
      }
    }
  }
  cout << ans;
}
