parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	p = 998244353
	n,s = readline() |> split |> parseMap
	a = readline() |> split |> parseMap
	dp = zeros(Int,n,s)
	if a[1]<=s
		dp[1,a[1]] = 1
	end
	ans = dp[1,s]*n
	for i in 2:n
		if a[i]<=s
			dp[i,a[i]] += i
		end
		for j in 1:s
			if j!=s
				dp[i,j]+=dp[i-1,j]
			end
			if j+a[i]<=s
				dp[i,j+a[i]]+=dp[i-1,j]
			end
		end
		ans = (ans+(dp[i,s]%p)*(n+1-i)%p)%p
	end
	println(ans)
end

main()