#include <bits/stdc++.h>
using namespace std;
const int md = 998244353;
int dp[3005][3005];
void solve() {
  int n, s;
  cin >> n >> s;
  vector<int> v(n + 5);
  for (int i = 1; i < n + 1; ++i) cin >> v[i];
  memset(dp, 0, sizeof dp);
  dp[n + 1][0] = 1;
  for (int i = 1; i < n + 1; ++i) dp[i][0] = n - i + 1;
  for (int i = n; i > 0; --i) {
    for (int j = 1; j < 3001; ++j) {
      dp[i][j] = dp[i + 1][j];
      if (j > v[i])
        dp[i][j] += dp[i + 1][j - v[i]], dp[i][j] %= md;
      else if (j == v[i])
        dp[i][j] += n - i + 1, dp[i][j] %= md;
      dp[i][j] %= md;
    }
  }
  int ans = 0;
  for (int i = 1; i < n + 1; ++i)
    if (v[i] <= s) ans += (i * dp[i + 1][s - v[i]]) % md, ans %= md;
  cout << ans << "\n";
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int T = 1;
  for (int t = 1; t < T + 1; ++t) {
    solve();
  }
  return 0;
}
