#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
inline long long read() {
  long long x = 0, w = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') w = -1;
    c = getchar();
  }
  while (c <= '9' && c >= '0') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return w == 1 ? x : -x;
}
long long dp[3005], n, s, a[3005];
const long long mod = 998244353;
int main() {
  n = read();
  s = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= s; i++) dp[i] = 0;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = s; j >= a[i]; j--) {
      if (j == a[i])
        dp[j] = (dp[j] + i) % mod;
      else
        dp[j] = (dp[j] + dp[j - a[i]]) % mod;
    }
    ans = (ans + (n - i + 1) * dp[s] % mod) % mod;
    dp[s] = 0;
  }
  return 0;
}
