#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
using PII = pair<int64, int64>;
const int64 kMod = 998244353;
int main() {
  int64 N, S;
  cin >> N >> S;
  vector<int64> A(N);
  for (int64& a : A) cin >> a;
  vector<map<PII, int64>> dp(3001);
  for (int64 i = 0; i < N; ++i) {
    for (int64 j = S - A[i]; j >= 0; --j) {
      int64 sum = j + A[i];
      for (auto& p : dp[j]) {
        PII range(p.first.first, i + 1);
        dp[sum][range] = dp[sum][range] + p.second;
      }
    }
    dp[A[i]][PII(i, i + 1)] = dp[A[i]][PII(i, i + 1)] + 1;
  }
  int64 ret = 0;
  for (auto& f : dp[S]) {
    int64 s = f.first.first;
    int64 e = f.first.second;
    ret = (ret + (s + 1) * (N - e + 1) % kMod * f.second) % kMod;
  }
  cout << ret << "\n";
  return 0;
}
