#include <bits/stdc++.h>
using ll = long long int;
using namespace std;
ll MOD = 998244353;
int main() {
  ll N, S, tmp;
  vector<ll> A;
  cin >> N >> S;
  for (ll i = 0; i < N; i++) {
    cin >> tmp;
    A.push_back(tmp);
  }
  ll ans = 0;
  vector<ll> flags(S + 1);
  for (ll L = 0; L < N; L++) {
    if (A[L] == S) {
      ans += (L + 1) * (N - L);
      ans = (ans + MOD) % MOD;
      continue;
    }
    if (A[L] > S) {
      continue;
    }
    for (ll i = 0; i < S + 1; i++) flags[i] = 0;
    flags[A[L]] = 1;
    for (ll R = L + 1; R < N; R++) {
      if (S > A[R]) {
        ans += (L + 1) * (N - R) * flags[S - A[R]];
        ans = (ans + MOD) % MOD;
      }
      for (ll i = S; i >= A[R] + 1; i--) {
        flags[i] = (flags[i] + flags[i - A[R]] + MOD) % MOD;
      }
    }
  }
  cerr << "Answer: " << endl;
  cout << ans << endl;
  return 0;
}
