#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
int main() {
  long long N, S;
  cin >> N >> S;
  long long A[3000];
  for (int i = 0; i < N; i++) cin >> A[i];
  vector<pair<pair<long long, long long>, long long>> dp[3001];
  dp[0].push_back(make_pair(make_pair(-1, -1), 1));
  for (int i = 0; i < N; i++) {
    for (int j = S + 1; j >= 0; j--) {
      if (j < A[i]) break;
      for (int k = 0; k < dp[j - A[i]].size(); k++) {
        long long start = dp[j - A[i]][k].first.first;
        long long num = dp[j - A[i]][k].second;
        if (start != -1)
          dp[j].push_back(make_pair(make_pair(start, i), num));
        else
          dp[j].push_back(make_pair(make_pair(i, i), num));
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i < dp[S].size(); i++) {
    long long start = dp[S][i].first.first;
    long long end = dp[S][i].first.second;
    long long num = dp[S][i].second;
    ans = (ans + (start + 1) * (N - end) * num) % mod;
  }
  cout << ans << endl;
  return 0;
}
