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