#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
const long long MOD = 998244353;
signed main() {
  int n, s;
  cin >> n >> s;
  long long dp[n + 1][3030][3];
  memset(dp, 0, sizeof(dp));
  dp[0][0][0] = 1;
  for (int i = 0; i < (n); i++) {
    int a;
    cin >> a;
    for (int j = 0; j < (3030); j++) {
      dp[i + 1][j][0] += dp[i][j][0];
      dp[i + 1][j][1] += dp[i][j][0] + dp[i][j][1];
      dp[i + 1][j][2] += dp[i][j][0] + dp[i][j][1] + dp[i][j][2];
      if (j + a < 3030) {
        dp[i + 1][j + a][1] += dp[i][j][0] + dp[i][j][1];
        dp[i + 1][j + a][2] += dp[i][j][0] + dp[i][j][1];
        for (int k = 0; k < (3); k++) {
          dp[i + 1][j + a][k] %= MOD;
        }
      }
    }
  }
  cout << dp[n][s][2] << endl;
}
