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