#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
void init_io() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
ll dp[4000][4000][3] = {};
signed main() {
  init_io();
  ll n, s, ans = 0;
  cin >> n >> s;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  dp[0][0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= s; j++) {
      dp[i + 1][j][0] += dp[i][j][0] % 98244353;
      dp[i + 1][j][0] %= 98244353;
      dp[i + 1][j][1] += dp[i][j][0] + dp[i][j][1];
      dp[i + 1][j][1] %= 98244353;
      dp[i + 1][j][2] += (dp[i][j][0] + dp[i][j][1] + dp[i][j][2]) % 98244353;
      dp[i + 1][j][2] %= 98244353;
      if (j >= a[i]) {
        ll v = (dp[i][j - a[i]][0] + dp[i][j - a[i]][1]) % 98244353;
        dp[i + 1][j][1] += v;
        dp[i + 1][j][1] %= 98244353;
        dp[i + 1][j][2] += v;
        dp[i + 1][j][2] %= 98244353;
      }
    }
  }
  cout << dp[n][s][2] << endl;
}
