#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long mod = 998244353;
vector<pair<long long, int> > dp[3001];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, s;
  cin >> n >> s;
  int i, j, a[n + 1];
  long long ans = 0;
  for (i = 1; i <= n; ++i) cin >> a[i];
  for (i = 1; i <= n; ++i) {
    for (j = s; j >= a[i]; --j) {
      if (dp[j - a[i]].size())
        for (auto it : dp[j - a[i]]) dp[j].push_back({it.first, i});
    }
    dp[a[i]].push_back({i, i});
  }
  for (auto it : dp[s]) ans += (n - it.second + 1) * 1ll * it.first, ans %= mod;
  cout << ans;
  return 0;
}
