package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 3
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}

	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	s := getNextInt(scanner)
	aa := make([]int, n)

	for i := 0; i < n; i++ {
		aa[i] = getNextInt(scanner)
	}
	dp := makeInts(n+1, s+1)
	dp[0][0] = 1
	var ans int
	for i := 0; i < n; i++ {
		for j := s; j >= 0; j-- {
			dp[i+1][j] = dp[i][j]
			if j-aa[i] < 0 {
				continue
			}
			dp[i+1][j] = mod(dp[i+1][j] + dp[i][j-aa[i]])
		}
		if s-aa[i] < 0 {
			continue
		}
		if dp[i][s-aa[i]] == 0 {
			continue
		}
		m := map[int]int{}
		m[s-aa[i]] = 1
		for j := i; j >= 0; j-- {
			mm := map[int]int{}
			for k, c := range m {
				if k == 0 {
					ans = mod(ans + mod((n-i)*(j+1))*c)
					continue
				}
				if dp[j][k] > 0 {
					mm[k] = mm[k] + c
				}
				if j-1 < 0 {
					continue
				}
				if k-aa[j-1] < 0 {
					continue
				}
				if dp[j][k-aa[j-1]] == 0 {
					continue
				}
				mm[k-aa[j-1]] = mm[k-aa[j-1]] + c
			}
			m = mm
		}
	}
	fmt.Fprintln(writer, ans)
}

func makeInts(h, w int) [][]int {
	index := make([][]int, h, h)
	data := make([]int, h*w, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}
func mod(x int) int {
	m := int(998244353)

	return (x%m + m) % m
}
