#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
int A[3010];
int N, S;
long long dp2[3010];
int main() {
  cin >> N >> S;
  long long ans = 0;
  for (int i = 1; i <= N; ++i) cin >> A[i];
  memset(dp2, 0, sizeof(dp2));
  dp2[A[N]] = 1;
  ans = ans + dp2[S] * N;
  for (int i = N - 1; i >= 1; --i) {
    if (A[i] < S) ans = (ans + dp2[S - A[i]] * i) % mod;
    if (A[i] == S) ans = (ans + (N - i + 1) * i) % mod;
    for (int j = S; j > A[i]; --j) {
      dp2[j] += dp2[j - A[i]];
    }
    dp2[A[i]] += (N - i + 1);
  }
  cout << ans << endl;
}
