#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int M = 4e3 + 1;
const int MD = 998244353;
int a[M];
long long dp[M][M], ans = 0, pre[M][M];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, s;
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= s; j++) {
      if (j == 0) {
        dp[i][j + a[i]] = i;
      } else {
        dp[i][j + a[i]] = (dp[i][j + a[i]] + pre[i - 1][j]) % MD;
      }
    }
    for (int j = 0; j <= s; j++) {
      pre[i][j] = (pre[i - 1][j] + dp[i][j]) % MD;
    }
  }
  for (int i = 1; i <= n; i++) {
    ans = (ans + ((n - i + 1) * dp[i][s]) % MD) % MD;
  }
  cout << ans;
  return 0;
}
