n,s,*a=map(int,open(0).read().split())
ans=0
mod=998244353
for i in range(n):
	d={a[i]:1}
	if a[i]==s:
		ans+=(i+1)*(n-i)
		ans%=mod
	for j,x in enumerate(a[i+1:],i+1):
		if s-x in d:
			ans+=(i+1)*(n-j)*d[s-x]
			ans%=mod
		for y in sorted(list(d.keys()))[::-1]:
			if x+y<=s:
				d[x+y]=d.get(x+y,0)+d[y]
				d[x+y]%=mod
print(ans)