#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  long long mod = 998244353;
  long long res = 0;
  long long n, s;
  cin >> n >> s;
  vector<long long> a(n + 5);
  for (int i = 0; i < (n); i++) cin >> a[i];
  vector<vector<long long>> dp(n + 5, vector<long long>(s + 5, -1));
  vector<vector<long long>> start(s + 5, {0});
  for (int i = 0; i < (n + 1); i++) dp[i][0] = 0;
  for (long long i = 1; i <= n; i++) {
    for (long long j = s; j >= 1; j--) {
      if (dp[i - 1][j] >= 0) dp[i][j] = dp[i - 1][j];
      if (j >= a[i - 1] && dp[i - 1][j - a[i - 1]] >= 0) {
        dp[i][j]++;
        if (j == a[i - 1]) {
          start[j].push_back(i);
        }
        for (long long x : start[j - a[i - 1]]) start[j].push_back(x);
      }
    }
    for (long long j : start[s]) {
      res += j * (n - i + 1);
      res %= mod;
    }
    while (start[s].size() > 0) start[s].pop_back();
  }
  cout << res << endl;
  return 0;
}
