export class Main {
  private static f = [];
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [n, s]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    const a: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    let result = 0;
    for (let i = 0; i < n; i++) {
      Main.culc(i, s, a);
      const m = Main.f[i][s];
      if (m == null) {
        continue;
      }
      for (let j = 0, len = m.length; j < len; j++) {
        result += ((m[j] + 1) * (n - i)) % 998244353;
      }
    }
    return `${result}`;
  }

  static culc(i, s, a) {
    const fi = {};
    Main.f[i] = fi;
    if (i == 0) {
      for (let j = 1; j <= s; j++) {
        fi[j] = a[i] == j ? [i] : null;
      }
    } else {
      for (let j = 1; j <= s; j++) {
        const remain = j - a[i];
        if (remain <= 0) {
          fi[j] = remain == 0 ? [i] : null;
        } else {
          let resultList = [];
          for (let k = 0; k < i; k++) {
            const map = Main.f[k];
            const list = map[remain];
            if (list != null) {
              resultList = resultList.concat(list);
            }
          }
          fi[j] = resultList.length == 0 ? null : resultList;
        }
      }
    }
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));