#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const int MX = 3005;
int n, s;
int inp[MX];
int dp[MX][MX];
int pre[MX][MX];
int main() {
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    cin >> inp[i];
  }
  for (int i = 1; i <= n; i++) {
    dp[i][inp[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    for (int k = 1; k <= s; k++) {
      pre[i][k] = (pre[i - 1][k] + dp[i][k]) % mod;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int k = 1; k <= s; k++) {
      if (inp[i] < k) {
        dp[i][k] = (dp[i][k] + pre[i - 1][k - inp[i]]) % mod;
      }
      pre[i][k] = (pre[i - 1][k] + dp[i][k]) % mod;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = (ans + (dp[i][s] * (n - i + 1)) % mod) % mod;
  }
  cout << ans << endl;
  return 0;
}
