#include <bits/stdc++.h>
using namespace std;
int main() {
  long N, S;
  cin >> N >> S;
  long waru = 998244353;
  vector<long> dp(S + 1);
  vector<long> pure(S + 1), filled(S + 1);
  vector<long> A(N);
  for (long& a : A) {
    cin >> a;
  }
  long count = 0;
  for (int i = 0; i < N; i++) {
    pure = vector<long>(S + 1);
    for (int k = S + 1 - A[i] - 1; k >= 0; k--) {
      if (k + A[i] == S) {
        count += dp[k] * (N - i) % waru;
      } else if (pure[k] == 0 && filled[k] == 1) {
        dp[k + A[i]] = (dp[k + A[i]] + dp[k]) % waru;
        pure[k + A[i]] = 1;
        filled[k + A[i]] = 1;
      }
    }
    if (A[i] < S) {
      dp[A[i]] += i + 1;
      filled[A[i]] = 1;
    }
    if (A[i] == S) {
      count += (N - i) * (i + 1) % waru;
    }
  }
  cout << count;
  return 0;
}
