#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3010;
const int MOD = 998244353;
int N, S;
int A[MAXN];
long long cnt[MAXN][MAXN];
long long pre[MAXN][MAXN];
void read() {
  cin >> N >> S;
  for (int u = 1; u <= N; u++) cin >> A[u];
}
void solve() {
  read();
  long long ans = 0;
  for (int u = 1; u <= N; u++) {
    if (A[u] > S) continue;
    if (A[u] == S) {
      ans = (ans + u * (N - u + 1) % MOD) % MOD;
      continue;
    }
    ans = (ans + cnt[u - 1][S - A[u]] * (N - u + 1) % MOD) % MOD;
    memcpy(cnt[u], cnt[u - 1], sizeof(cnt[u - 1]));
    for (int v = A[u]; v <= S; v++) {
      cnt[u][v] = (cnt[u][v] + cnt[u - 1][v - A[u]]) % MOD;
    }
    cnt[u][A[u]] = (cnt[u][A[u]] + u) % MOD;
  }
  cout << ans;
}
int main() { solve(); }
