#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 100;
const int maxc = 26;
const int mod = 998244353;
long long dp[3500];
long long a[3500];
int main() {
  int n, s;
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    dp[0]++;
    for (int j = s; j >= s - a[i]; j--) {
      int u = j - a[i];
      if (u >= 0 && u <= s) {
        if (j == s)
          ans = (ans + dp[u] * (n - i + 1)) % mod;
        else if (u)
          dp[j] = (dp[j] + dp[u]) % mod;
      }
    }
    if (a[i] <= s) dp[a[i]] = (dp[a[i]] + i) % mod;
  }
  printf("%lld\n", ans);
  return 0;
}
