#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
int main(void) {
  int N, S;
  cin >> N >> S;
  int dp[N + 1][S + 1];
  int A[N];
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N + 1; i++)
    for (int j = 0; j < S + 1; j++) dp[i][j] = 0;
  dp[0][0] = 1;
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < S; j++) (dp[i + 1][j] += dp[i][j]) %= MOD;
    if (A[i] <= S) dp[i + 1][A[i]] += i + 1;
    for (int j = 1; j < S; j++) {
      if (A[i] + j <= S) (dp[i + 1][A[i] + j] += dp[i][j]) %= MOD;
      if (A[i] + j == S) (ans += dp[i][j] * (N - i)) %= MOD;
    }
    if (A[i] == S) ans += (i + 1) * (N - i);
  }
  cout << ans << endl;
  return 0;
}
