#include <bits/stdc++.h>
using namespace std;
const long long MAX = 3e3 + 100;
long long a[MAX], n, s, dp[MAX][MAX][3], mod = 998244353;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> s;
  for (long long i = 0; i < (long long)n; i++) cin >> a[i];
  dp[0][0][0] = 1;
  for (long long i = 0; i < (long long)n; i++) {
    for (long long j = 0; j < (long long)s + 1; j++) {
      dp[i + 1][j][0] = (dp[i + 1][j][0] + dp[i][j][0]) % mod;
      dp[i + 1][j][1] = (dp[i + 1][j][1] + dp[i][j][0] + dp[i][j][1]) % mod;
      dp[i + 1][j][2] =
          (dp[i + 1][j][2] + dp[i][j][0] + dp[i][j][1] + dp[i][j][2]) % mod;
      if (j + a[i + 1] <= s) {
        dp[i + 1][j + a[i + 1]][1] =
            (dp[i + 1][j + a[i + 1]][1] + dp[i][j][0] + dp[i][j][1]) % mod;
        dp[i + 1][j + a[i + 1]][2] =
            (dp[i + 1][j + a[i + 1]][2] + dp[i][j][0] + dp[i][j][1]) % mod;
      }
    }
  }
  cout << dp[n][s][2] << endl;
  return 0;
}
