from collections import *
from heapq import *
from itertools import *
from fractions import gcd
import sys
from decimal import *
input=lambda :sys.stdin.readline().rstrip()

N,S=map(int,input().split())
A=list(map(int,input().split()))
mod=998244353
dp=[defaultdict(int) for i in range(S+1)]
lst=set()
if A[0]<=S:
    dp[A[0]][0]+=1
    lst.add(A[0])
count=0
for n in range(1,N):
    nlst=set()
    for i in lst:
        b=i+A[n]
        if b<=S:
            for a in dp[i]:
                dp[b][a]+=dp[i][a]
            if not b in lst:
                nlst.add(b)
    if A[n]<=S:
        dp[A[n]][n]+=1
        lst.add(A[n])
    lst|=nlst

    for i in dp[S]:
        count+=(i+1)*dp[S][i]
        count%=mod
#print(dp)
print(count)
