#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const long long INF = 1e18;
long long n, s;
long long a[3005];
long long dp[3005][3005][2];
long long dfs(long long i, long long j, long long state) {
  long long &an = dp[i][j][state];
  if (an != -1) return an;
  if (j > s) return an = 0;
  if (j == s) {
    if (state == 1)
      return an = (n - i + 1);
    else
      return an = 0;
  }
  if (i == n) {
    return an = 0;
  }
  return an = (dfs(i + 1, j, 0) + dfs(i + 1, j + a[i], 1)) % mod;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  for (long long i = 0; i < 3005; i++)
    for (long long j = 0; j < 3005; j++)
      for (long long k = 0; k < 2; k++) dp[i][j][k] = -1;
  cin >> n >> s;
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans = (ans + (i + 1) * dfs(i + 1, a[i], 1)) % mod;
  }
  cout << ans << '\n';
  return 0;
}
