#include <bits/stdc++.h>
int main() {
  long k, n, s, j, a, m = 998244353, d[3001] = {};
  scanf("%ld%ld", &n, &s);
  while (n--) {
    scanf("%ld", &a);
    j = s + 1;
    while (j-- > a) {
      d[j] += d[j - a];
    }
    d[a]++;
    d[0]++;
    k += d[s];
  }
  printf("%ld\n", k % m);
}
