#include <bits/stdc++.h>
int n, s, f[3005][3005], a[3005], p[3005], ans;
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), p[i] = p[i - 1] + a[i];
  for (int i = 1; i <= n; ++i) {
    if (s >= a[i]) f[i][s] = f[i - 1][s - a[i]];
    f[i][a[i]] += i;
    for (int j = 1; j < s; ++j)
      if (j >= a[i])
        f[i][j] += f[i - 1][j] + f[i - 1][j - a[i]];
      else
        f[i][j] += f[i - 1][j];
  }
  for (int i = 1; i <= n; ++i)
    ans = (ans + f[i][s] * (n - i + 1) % 998244353) % 998244353;
  return printf("%d", ans), 0;
}
