#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353LL;
const long long INF_LL = 1e18 + 3;
const int INF_int = 1e9 + 3;
int main() {
  int n, s;
  cin >> n >> s;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long dp1[n + 1][s + 1];
  long long dp2[n + 1][s + 1];
  for (int i = 0; i < n + 1; i++)
    for (int j = 0; j < s + 1; j++) dp1[i][j] = 0LL;
  for (int i = 0; i < n + 1; i++)
    for (int j = 0; j < s + 1; j++) dp2[i][j] = 0LL;
  dp1[0][0] = 1LL;
  long long ans = 0;
  long long tekitou[n], tekitou2[n];
  for (int i = 0; i < n; i++) {
    for (int j = a[i]; j < s + 1; j++)
      dp1[i + 1][j] = (dp1[i][j] + dp1[i][j - a[i]]), dp1[i + 1][j] %= MOD;
    for (int j = 0; j < a[i]; j++)
      dp1[i + 1][j] = dp1[i][j], dp1[i + 1][j] %= MOD;
    ans += dp1[i + 1][s];
    ans %= MOD;
  }
  dp2[n][0] = 1LL;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = a[i]; j < s + 1; j++)
      dp2[i][j] = (dp2[i + 1][j] + dp2[i + 1][j - a[i]]), dp2[i][j] %= MOD;
    for (int j = 0; j < a[i]; j++) dp2[i][j] = dp2[i + 1][j], dp2[i][j] %= MOD;
    ans += dp2[i][s];
    ans %= MOD;
  }
  cout << ans - dp1[n][s] << endl;
}
