n,s=map(int,input().split())
l=list(map(int,input().split()))
mod=998244353
dp=[[0 for i in range(s+1)] for i in range(n+1)]
dp[0][0]=1
dpi=[[0 for i in range(s+1)] for i in range(n+1)]
dpi[0][0]=1
for i,a in enumerate(l,1):
    for j in range(a):
        dp[i][j]=dp[i-1][j]
    for j in range(a,s+1):
        dp[i][j]=dp[i-1][j-a]+dp[i-1][j]%mod
for i,a in enumerate(l[::-1],1):
    for j in range(a):
        dpi[i][j]=dpi[i-1][j]
    for j in range(a,s+1):
        dpi[i][j]=dpi[i-1][j-a]+dpi[i-1][j]%mod      
st=[]
en=[]
for i in range(n+1):
    st.append(dp[i][-1])
    en.append(dpi[i][-1])
ans=0
t=dp[-1][-1]
for L in range(1,n+1):
    for R in range(L,n+1):
        ans+=abs(st[R]+en[n-L+1]-t)
        ans%=mod
print(ans)