#include <bits/stdc++.h>
using namespace std;
const long long N = 3003, mod = 998244353;
long long a[N], dp[2][N], n, s, ans;
long long M(long long x) {
  long long ret = x % mod;
  ret += mod;
  ret %= mod;
  return ret;
}
signed main() {
  cin >> n >> s;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (long long i = 1; i <= n; i++) {
    dp[i % 2][a[i]] = i;
    for (long long j = 1; j <= s; j++) {
      if (j != a[i]) dp[i % 2][j] = 0;
      dp[i % 2][j] += M(dp[1 - (i % 2)][j] + dp[1 - (i % 2)][j - a[i]]);
      dp[i % 2][j] = M(dp[i % 2][j]);
    }
    ans += M((dp[i % 2][s] - dp[1 - (i % 2)][s]) * (n - i + 1));
    ans = M(ans);
  }
  cout << ans;
}
