M = 998244353

N, S = map(int, input().split())
A_list = list(map(int, input().split()))

def calc(A_list):
	data_table = [0 for _ in range(S + 1)]
	data_table[0] = 1
	
	sum_list = [0] * N
	sum = 0
	for j in range(N - 1, -1, -1):
		a = A_list[j]
		sum += a
		sum_list[j] = a
	
	counts_rev = []
	
	for j, a in enumerate(A_list):
		for i in range(S, -1, -1):
			data = data_table[i]
			if data > 0:
				s = i + a
				if s <= S:
					data_table[s] = (data_table[s] + data) % M
		
		s = S - sum_list[j]
		if s > 0 and s <= S:
			counts_rev.append(data_table[s])
		else:
			counts_rev.append(0)
	
	return data_table, counts_rev

d1, c1 = calc(A_list)
d2, c2 = calc(list(reversed(A_list)))

c2.reverse()

total = 0

for l in range(N):
	for r in range(l + 1, N + 1):
#		print(d1[l], c2[r] if r < N else 0)
		total += d1[l] - (c2[r] if r < N else 0)

print(total % M)
