#include <bits/stdc++.h>
using namespace std;
long long n, s, A[200001], ans = 0, mod = 998244353;
long long dp[3001][3001] = {0};
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; i++) cin >> A[i];
  for (int i = 0; i < n; i++)
    if (A[i] <= s) dp[i + 1][A[i]] = i + 1 + i * (n - i) * (A[i] == s);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < s + 1; j++) {
      if (j < s) {
        (dp[i + 1][j] += dp[i][j]) %= mod;
        if (j >= A[i]) (dp[i + 1][j] += dp[i][j - A[i]]) %= mod;
      } else {
        (dp[i + 1][j] += dp[i][j]) %= mod;
        if (j >= A[i]) (dp[i + 1][j] += (n - i) * dp[i][j - A[i]]) %= mod;
      }
    }
  cout << dp[n][s];
}
