#include <bits/stdc++.h>
using namespace std;
int n, s;
int in[3010];
long long sum[3010];
vector<pair<long long, long long>> dp[3010];
const long long mod = 998244353;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    cin >> in[i];
    sum[i] = sum[i - 1] + in[i];
  }
  for (int i = 1; i <= n; i++)
    for (int j = s; j >= in[i]; j--) {
      if (j == in[i])
        dp[j].push_back({i, i});
      else if (dp[j - in[i]].size()) {
        for (auto a : dp[j - in[i]]) {
          a.second = i;
          dp[j].push_back(a);
        }
      }
    }
  long long ans = 0;
  for (auto i : dp[s]) {
    ans = (ans + (i.first * (n - i.second + 1)) % mod) % mod;
  }
  cout << ans << '\n';
  return 0;
}
