#include <bits/stdc++.h>
using namespace std;
const int N = 3001;
int a[N], dp[N][N][3];
void solve() {
  int n, s;
  cin >> n >> s;
  for (int i = 0; i < n; i++) cin >> a[i];
  dp[0][0][0] = 1;
  int inf = 998244353;
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= s; j++) {
      dp[i + 1][j][0] = (dp[i + 1][j][0] + dp[i][j][0]) % inf;
      dp[i + 1][j][1] = (dp[i + 1][j][1] + dp[i][j][0] + dp[i][j][1]) % inf;
      dp[i + 1][j][2] =
          (dp[i + 1][j][2] + dp[i][j][0] + dp[i][j][1] + dp[i][j][2]) % inf;
      if (j + a[i] <= s) {
        dp[i + 1][j + a[i]][1] =
            (dp[i + 1][j + a[i]][1] + dp[i][j][0] + dp[i][j][1]) % inf;
        dp[i + 1][j + a[i]][2] =
            (dp[i + 1][j + a[i]][2] + dp[i][j][0] + dp[i][j][1]) % inf;
      }
    }
  cout << dp[n][s][2] << '\n';
}
int main() {
  int q = 1;
  for (int i = 1; i <= q; i++) {
    solve();
  }
  return 0;
}
