import sys
from functools import lru_cache

sys.setrecursionlimit(10**4)

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)]

@lru_cache(maxsize=None)
def pack(rest, room):
	number = 0
	if room == 0:
		return rest + 1
	elif rest == 0:
		return 0

	if room >= a[rest-1]:
		number += pack(rest-1, room-a[rest-1])
		number %= mod

	number += pack(rest-1, room)
	number %= mod

	return number
		

def get_answer():
	answer = 0
	for i in range(n+1):
		answer += pack(i, s)
	return answer

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans)
