#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, S;
  cin >> N >> S;
  int a[N];
  for (int i = 0; i < N; i++) cin >> a[i];
  long long dp[N][S + 1];
  memset(dp, 0, sizeof dp);
  long long ans = 0;
  const int M = 998244353;
  for (int r = 0; r < N; r++) {
    if (a[r] > S) continue;
    dp[r][a[r]] = 1;
    ans += dp[r][S] * (r + 1) % M;
    for (int l = 0; l < r; l++) {
      for (int t = S - a[r]; t >= 0; t--) (dp[l][t + a[r]] += dp[l][t]) %= M;
      ans += (long long)dp[l][S] * (l + 1);
      ans %= M;
    }
  }
  cout << ans % M << endl;
}
