#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
const int N_MAX = 3000;
const int S_MAX = 3000;
const int A_I_MAX = 3000;
const int MOD = 998244353;
int N, S;
vector<int> A;
vector<ll> dp;
int main() {
  cin >> N >> S;
  A = vector<int>(N);
  for (int i = 0; i < (int)(N); i++) cin >> A[i];
  ll ans = 0;
  dp = vector<ll>(S + 1, 0);
  dp[0] = 1;
  for (int i = 0; i < (int)(N); i++) {
    for (int j = S; j >= A[i]; j--) {
      dp[j] = (dp[j] + dp[j - A[i]]) % MOD;
    }
    ans = ans + (dp[S] * (N - i) % MOD) % MOD;
    dp[0]++;
    dp[S] = 0;
  }
  cout << ans << endl;
}
