#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, s;
  cin >> n >> s;
  vector<int64_t> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  int64_t dp[n + 1][s + 1];
  int64_t ans = 0;
  for (int64_t l = 1; l <= n; ++l) {
    if (a[l - 1] > s) continue;
    for (int i = 0; i < s + 1; ++i) dp[l][i] = 0;
    dp[l][a[l - 1]] = 1;
    if (a[l - 1] == s) ans = (ans + l) % 998244353ULL;
    for (int64_t r = l + 1; r <= n; ++r) {
      for (int j = 0; j < s + 1; ++j) {
        if (j - a[r - 1] >= 0) {
          dp[r][j] = (dp[r - 1][j] + dp[r - 1][j - a[r - 1]]) % 998244353ULL;
          if (j == s) {
            ans = (ans + l * (n - r + 1) % 998244353ULL *
                             dp[r - 1][j - a[r - 1]] % 998244353ULL) %
                  998244353ULL;
          }
        } else {
          dp[r][j] = dp[r - 1][j];
        }
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
