#include <bits/stdc++.h>
using namespace std;
const int64_t MOD = 998244353;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int64_t n, s;
  cin >> n >> s;
  int64_t arr[n + 1];
  arr[0] = 0;
  for (int64_t i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  int64_t ans = 0;
  int64_t dp[n + 1][s + 1];
  for (int64_t i = 0; i <= n; i++) {
    for (int64_t j = 0; j <= s; j++) {
      dp[i][j] = 0;
    }
  }
  for (int64_t i = 1; i <= n; i++) {
    dp[i][arr[i]] += i;
    for (int64_t j = 0; j <= s; j++) {
      if (j + arr[i] <= s) {
        dp[i][j + arr[i]] += dp[i - 1][j];
        dp[i][j + arr[i]] %= MOD;
      }
      dp[i][j] += dp[i - 1][j];
      dp[i][j] %= MOD;
    }
    ans += (dp[i][s] * (n - i + 1));
    ans %= MOD;
    dp[i][s] = 0;
  }
  cout << ans;
  return 0;
}
