

n, s = [0] * 2
a = []
mod = 998244353

def format_input(filename = None):
	global n, s
	global a
	if filename == None:
		n, s = list(map(int, input().split()))
		a = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(1, 3 * 10**3)
		s = rng(1, 3 * 10**3)
		a = [rng(1, 3 * 10**3) for i in range(n)]

answer = 0
def pack(start, end, room):
	global answer
	if end < n:
		if room == a[end]:
			answer += (start + 1) * (n - end)
			answer %= mod
		elif room > a[end]:
			for i in range(n-end):
				pack(start, end+i+1, room - a[end])

def get_answer():
	global answer
	for i in range(n):
		if s == a[i]:
			answer += (i + 1) * (n - i)
			answer %= mod
		elif s > a[i]:
			for j in range(n-i):
				pack(i, i+j+1, s - a[i])
	return answer

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans)
