#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
long long dp[1001][1001];
long long dp1[1001][1001];
int N, S;
int a[1001];
void solve(int t) {
  cin >> N >> S;
  for (int i = 1; i <= S; i++)
    for (int j = 0; j <= N; j++) {
      dp[j][i] = 0;
      dp1[j][i] = 0;
    }
  for (int i = 1; i <= N; i++) cin >> a[i];
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= S - a[i]; j++) {
      dp[i][j + a[i]] = (dp[i][j + a[i]] + dp1[i - 1][j]) % mod;
    }
    dp[i][a[i]] = (dp[i][a[i]] + i) % mod;
    for (int j = 0; j <= S; j++) dp1[i][j] = (dp[i][j] + dp1[i - 1][j]) % mod;
  }
  long long ans = 0;
  for (int i = 1; i <= N; i++) {
    ans = (ans + dp[i][S] * (N - i + 1)) % mod;
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  for (int t = 1; t <= T; t++) solve(t);
}
