#include <bits/stdc++.h>
using namespace std;
int n, S, a[3005], ans, F[3005][3005], g[3005][3005];
int main() {
  scanf("%d %d", &n, &S);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  F[0][0] = 0, g[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    if (a[i] == S)
      (ans += 1ll * i * (n - i + 1) % 998244353) %= 998244353;
    else if (a[i] < S)
      (ans += 1ll * F[i - 1][S - a[i]] * (n - i + 1) % 998244353) %= 998244353;
    for (int j = 0; j <= n; j++) {
      (F[i][j] += F[i - 1][j]) %= 998244353;
      (g[i][j] += g[i - 1][j]) %= 998244353;
      if (j >= a[i]) {
        if (j == a[i])
          (F[i][j] +=
           (F[i - 1][j - a[i]] + 1ll * i * g[i - 1][j - a[i]] % 998244353) %
           998244353) %= 998244353;
        else
          (F[i][j] += F[i - 1][j - a[i]]) %= 998244353;
        (g[i][j] += g[i - 1][j - a[i]]) %= 998244353;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
