#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
long long dp[3010] = {0}, ans = 0;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    for (int j = m; j >= 0; j--) {
      if (j - x < 0) break;
      if (j == m) {
        if (m - x > 0)
          ans = (ans + 1ll * dp[m - x] * (n - i + 1)) % mod;
        else
          ans = (ans + 1ll * i * (n - i + 1)) % mod;
        dp[m] = 0;
      } else if (j == x) {
        dp[j] = (dp[j] + i) % mod;
      } else
        dp[j - x] = (dp[j] + dp[j - x]) % mod;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
