#include <bits/stdc++.h>
using namespace std;
const long long int maxn = 3011, mod = 998244353;
long long int dp[maxn][maxn];
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long int n, s;
  cin >> n >> s;
  vector<long long int> mas(n, 0);
  for (long long int d = 0; d < n; d++) {
    cin >> mas[d];
  }
  dp[0][0] = 1;
  for (long long int d = 1; d <= n; d++) {
    dp[d][0] = d + 1;
    dp[d][mas[d - 1]] = dp[d - 1][mas[d - 1]] + d;
    for (long long int s1 = 1; s1 <= s; s1++) {
      if (s1 != mas[d - 1]) {
        dp[d][s1] = dp[d - 1][s1];
        if (s1 >= mas[d - 1]) {
          dp[d][s1] += dp[d - 1][s1 - mas[d - 1]];
        }
      }
      dp[d][s1] %= mod;
    }
  }
  long long int ans = 0;
  long long int tk = 1;
  for (long long int d = n - 1; d >= 0; d--) {
    ans += tk * dp[d][s - mas[d]];
    ans %= mod;
    tk++;
  }
  cout << ans;
}
