#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, S;
  cin >> N >> S;
  vector<int> A(N);
  for (int i = 0; i < (N); i++) cin >> A[i];
  long long mod = 998244353;
  int dp[3001][3001][3] = {};
  dp[0][0][0] = 1;
  for (int i = 0; i < (N); i++) {
    for (int j = 0; j < (3001); j++) {
      (dp[i + 1][j][0] += dp[i][j][0]) %= mod;
      (dp[i + 1][j][1] += dp[i][j][0] + dp[i][j][1]) %= mod;
      if (j + A[i] <= S)
        (dp[i + 1][j + A[i]][1] += dp[i][j][0] + dp[i][j][1]) %= mod;
      (dp[i + 1][j][2] += dp[i][j][0] + dp[i][j][1] + dp[i][j][2]) %= mod;
      if (j + A[i] <= S)
        (dp[i + 1][j + A[i]][2] += dp[i][j][0] + dp[i][j][1]) %= mod;
    }
  }
  cout << dp[N][S][2] << endl;
}
